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.
71 72 73 |
# File 'lib/dry/types/primitive_inferrer.rb', line 71 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.
68 69 70 |
# File 'lib/dry/types/primitive_inferrer.rb', line 68 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
80 81 82 83 84 |
# File 'lib/dry/types/primitive_inferrer.rb', line 80 def [](type) self.class.fetch_or_store(type) do Array(compiler.visit(type.to_ast)).freeze end end |