Class: Dry::Types::PrimitiveInferrer
- Inherits:
-
Object
- Object
- Dry::Types::PrimitiveInferrer
- Extended by:
- Core::Cache
- Defined in:
- lib/dry/types/primitive_inferrer.rb
Overview
PrimitiveInferrer returns the list of classes matching a type.
Defined Under Namespace
Classes: Compiler
Instance Attribute Summary collapse
- #compiler ⇒ Compiler readonly private
Instance Method Summary collapse
-
#[](type) ⇒ Array[Class]
private
Infer primitives from the provided type.
-
#initialize ⇒ PrimitiveInferrer
constructor
private
A new instance of PrimitiveInferrer.
Constructor Details
#initialize ⇒ PrimitiveInferrer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of PrimitiveInferrer.
79 80 81 |
# File 'lib/dry/types/primitive_inferrer.rb', line 79 def initialize @compiler = Compiler.new end |
Instance Attribute Details
#compiler ⇒ Compiler (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
76 77 78 |
# File 'lib/dry/types/primitive_inferrer.rb', line 76 def compiler @compiler end |
Instance Method Details
#[](type) ⇒ Array[Class]
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Infer primitives from the provided type
88 89 90 91 92 |
# 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 |