Class: Dry::Schema::TypesMerger Private

Inherits:
Object
  • Object
show all
Defined in:
lib/dry/schema/types_merger.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.

Combines multiple logical operations into a single type, taking into account the type of logical operation (or, and, implication) and the underlying types (schemas, nominals, etc.)

Defined Under Namespace

Classes: ValueMerger

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type_registry = TypeRegistry.new) ⇒ TypesMerger

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



171
172
173
# File 'lib/dry/schema/types_merger.rb', line 171

def initialize(type_registry = TypeRegistry.new)
  @type_registry = type_registry
end

Instance Attribute Details

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



11
12
13
# File 'lib/dry/schema/types_merger.rb', line 11

def type_registry
  @type_registry
end

Instance Method Details

#call(op_class, lhs, rhs) ⇒ 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.



176
177
178
179
180
# File 'lib/dry/schema/types_merger.rb', line 176

def call(op_class, lhs, rhs)
  lhs.merge(rhs) do |_k, old, new|
    ValueMerger.new(self, op_class, old, new).call
  end
end