class Dry::Types::PrimitiveInferrer

PrimitiveInferrer returns the list of classes matching a type.

@api public

Attributes

compiler[R]

@return [Compiler] @api private

Public Class Methods

new() click to toggle source

@api private

# File lib/dry/types/primitive_inferrer.rb, line 79
def initialize
  @compiler = Compiler.new
end

Public Instance Methods

[](type) click to toggle source

Infer primitives from the provided type

@return [Array]

@api private

# File lib/dry/types/primitive_inferrer.rb, line 88
def [](type)
  self.class.fetch_or_store(type) do
    Array(compiler.visit(type.to_ast)).freeze
  end
end