Module: Dry::Doc::Value::Types

Defined in:
lib/dry/doc/value.rb

Constant Summary collapse

Inlines =
Set.new

Class Method Summary collapse

Class Method Details

.[](type) ⇒ Object



22
23
24
# File 'lib/dry/doc/value.rb', line 22

def self.[] type
  ::Dry::Doc::Value::Types::Array.member type
end

.constant(value) ⇒ Object



12
13
14
# File 'lib/dry/doc/value.rb', line 12

def self.constant value
  ::Dry::Doc::Value::T::Constant value
end

.inline?(klass) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/dry/doc/value.rb', line 26

def self.inline? klass
  ::Dry::Doc::Value::Types::Inlines.include? klass
end

.instance(klass) ⇒ Object



8
9
10
# File 'lib/dry/doc/value.rb', line 8

def self.instance klass
  ::Dry::Doc::Value::T::Constructor klass
end

.sum(left, right) ⇒ Object



16
17
18
19
20
# File 'lib/dry/doc/value.rb', line 16

def self.sum left, right
  left  = instance left unless left.respond_to? :to_ast
  right = instance right unless right.respond_to? :to_ast
  ::Dry::Types::Sum.new left, right
end