Module: Remap::Mapper::Operations
- Included in:
- Remap::Mapper, Remap::Mapper
- Defined in:
- lib/remap/mapper.rb
Overview
Tries self and other and returns the first successful result
Instance Method Summary collapse
-
#&(other) ⇒ Mapper::And
Returns a successful result when self & other are successful.
-
#^(other) ⇒ Mapper:Xor
Returns a successful result when only one of self & other are successful.
- #|(other) ⇒ Object
Instance Method Details
#&(other) ⇒ Mapper::And
Returns a successful result when self & other are successful
23 24 25 26 27 |
# File 'lib/remap/mapper.rb', line 23 def &(other) And.new(left: self, right: other) rescue Dry::Struct::Error => e raise ArgumentError, e. end |
#^(other) ⇒ Mapper:Xor
Returns a successful result when only one of self & other are successful
34 35 36 37 38 |
# File 'lib/remap/mapper.rb', line 34 def ^(other) Xor.new(left: self, right: other) rescue Dry::Struct::Error => e raise ArgumentError, e. end |
#|(other) ⇒ Object
12 13 14 15 16 |
# File 'lib/remap/mapper.rb', line 12 def |(other) Or.new(left: self, right: other) rescue Dry::Struct::Error => e raise ArgumentError, e. end |