Class: Dry::Types::PrimitiveInferrer::Compiler Private
- Inherits:
-
Object
- Object
- Dry::Types::PrimitiveInferrer::Compiler
- Defined in:
- lib/dry/types/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.
Compiler reduces type AST into a list of primitives
Instance Method Summary collapse
- #visit(node) ⇒ Object private
- #visit_any(_) ⇒ Object private
- #visit_array(_) ⇒ Object private
- #visit_constrained(node) ⇒ Object private
- #visit_constructor(node) ⇒ Object private
- #visit_enum(node) ⇒ Object private
- #visit_hash(_) ⇒ Object (also: #visit_schema) private
- #visit_lax(node) ⇒ Object private
- #visit_nominal(node) ⇒ Object private
- #visit_sum(node) ⇒ Object private
Instance Method Details
#visit(node) ⇒ Object
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.
16 17 18 19 |
# File 'lib/dry/types/primitive_inferrer.rb', line 16 def visit(node) meth, rest = node public_send(:"visit_#{meth}", rest) end |
#visit_any(_) ⇒ Object
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.
69 70 71 |
# File 'lib/dry/types/primitive_inferrer.rb', line 69 def visit_any(_) ::Object end |
#visit_array(_) ⇒ Object
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.
34 35 36 |
# File 'lib/dry/types/primitive_inferrer.rb', line 34 def visit_array(_) ::Array end |
#visit_constrained(node) ⇒ Object
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.
63 64 65 66 |
# File 'lib/dry/types/primitive_inferrer.rb', line 63 def visit_constrained(node) other, * = node visit(other) end |
#visit_constructor(node) ⇒ Object
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.
44 45 46 47 |
# File 'lib/dry/types/primitive_inferrer.rb', line 44 def visit_constructor(node) other, * = node visit(other) end |
#visit_enum(node) ⇒ Object
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.
50 51 52 53 |
# File 'lib/dry/types/primitive_inferrer.rb', line 50 def visit_enum(node) other, * = node visit(other) end |
#visit_hash(_) ⇒ Object Also known as: visit_schema
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.
28 29 30 |
# File 'lib/dry/types/primitive_inferrer.rb', line 28 def visit_hash(_) ::Hash end |
#visit_lax(node) ⇒ Object
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.
39 40 41 |
# File 'lib/dry/types/primitive_inferrer.rb', line 39 def visit_lax(node) visit(node) end |
#visit_nominal(node) ⇒ Object
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.
22 23 24 25 |
# File 'lib/dry/types/primitive_inferrer.rb', line 22 def visit_nominal(node) type, _ = node type end |
#visit_sum(node) ⇒ Object
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.
56 57 58 59 60 |
# File 'lib/dry/types/primitive_inferrer.rb', line 56 def visit_sum(node) left, right = node [visit(left), visit(right)].flatten(1) end |