Class: Dry::Types::PrimitiveInferrer::Compiler Private

Inherits:
Object
  • Object
show all
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

API:

  • private

Instance Method Summary collapse

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.

API:

  • private



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.

API:

  • private



51
# File 'lib/dry/types/primitive_inferrer.rb', line 51

def visit_any(_) = ::Object

#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.

API:

  • private



29
# File 'lib/dry/types/primitive_inferrer.rb', line 29

def visit_array(_) = ::Array

#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.

API:

  • private



48
# File 'lib/dry/types/primitive_inferrer.rb', line 48

def visit_constrained(node) = visit(node[0])

#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.

API:

  • private



35
# File 'lib/dry/types/primitive_inferrer.rb', line 35

def visit_constructor(node) = visit(node[0])

#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.

API:

  • private



38
# File 'lib/dry/types/primitive_inferrer.rb', line 38

def visit_enum(node) = visit(node[0])

#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.

API:

  • private



25
# File 'lib/dry/types/primitive_inferrer.rb', line 25

def visit_hash(_) = ::Hash

#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.

API:

  • private



32
# File 'lib/dry/types/primitive_inferrer.rb', line 32

def visit_lax(node) = visit(node)

#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.

API:

  • private



22
# File 'lib/dry/types/primitive_inferrer.rb', line 22

def visit_nominal(node) = node[0]

#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.

API:

  • private



41
42
43
44
45
# File 'lib/dry/types/primitive_inferrer.rb', line 41

def visit_sum(node)
  left, right = node

  [visit(left), visit(right)].flatten(1)
end