Module: Remap::Mapper::Operations

Included in:
Remap::Mapper, Remap::Mapper
Defined in:
lib/remap/mapper/support/operations.rb

Instance Method Summary collapse

Instance Method Details

#&(other) ⇒ Mapper::And

Returns a successful result when self & other are successful

Parameters:

Returns:



22
23
24
25
26
# File 'lib/remap/mapper/support/operations.rb', line 22

def &(other)
  And.new(left: self, right: other)
rescue Dry::Struct::Error => e
  raise ArgumentError, e.message
end

#^(other) ⇒ Mapper:Xor

Returns a successful result when only one of self & other are successful

Parameters:

Returns:

  • (Mapper:Xor)


33
34
35
36
37
# File 'lib/remap/mapper/support/operations.rb', line 33

def ^(other)
  Xor.new(left: self, right: other)
rescue Dry::Struct::Error => e
  raise ArgumentError, e.message
end

#|(other) ⇒ Mapper::Or

Tries self and other and returns the first successful result

Parameters:

Returns:



11
12
13
14
15
# File 'lib/remap/mapper/support/operations.rb', line 11

def |(other)
  Or.new(left: self, right: other)
rescue Dry::Struct::Error => e
  raise ArgumentError, e.message
end