module Remap::Mapper::Operations

Public Instance Methods

&(other) click to toggle source

Returns a successful result when self & other are successful

@param other [Mapper]

@return [Mapper::And]

# 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) click to toggle source

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

@param other [Mapper]

@return [Mapper:Xor]

# 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) click to toggle source

Tries self and other and returns the first successful result

@param other [Mapper]

@return [Mapper::Or]

# 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