Class: Dry::Schema::PrimitiveInferrer Private
- Inherits:
-
Object
- Object
- Dry::Schema::PrimitiveInferrer
- Extended by:
- Core::Cache
- Defined in:
- lib/dry/schema/primitive_inferrer.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
PrimitiveInferrer is used internally by ‘Macros::Filled` for inferring a list of possible primitives that a given type can handle.
Defined Under Namespace
Classes: Compiler
Instance Attribute Summary collapse
- #compiler ⇒ Compiler readonly private
Instance Method Summary collapse
-
#[](type) ⇒ Symbol
private
Infer predicate identifier 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.
82 83 84 |
# File 'lib/dry/schema/primitive_inferrer.rb', line 82 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.
79 80 81 |
# File 'lib/dry/schema/primitive_inferrer.rb', line 79 def compiler @compiler end |
Instance Method Details
#[](type) ⇒ Symbol
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 predicate identifier from the provided type
91 92 93 94 95 |
# File 'lib/dry/schema/primitive_inferrer.rb', line 91 def [](type) self.class.fetch_or_store(type.hash) do Array(compiler.visit(type.to_ast)).freeze end end |