Class: Remap::Mapper::Or
- Inherits:
-
Binary
- Object
- Dry::Struct
- Struct
- Remap::Mapper
- Binary
- Remap::Mapper::Or
- Defined in:
- lib/remap/mapper/or.rb
Overview
Represents two mappers that are combined with the | operator
Instance Method Summary collapse
-
#call!(state) {|if| ... } ⇒ Result
Succeeds if left or right succeeds Returns which ever succeeds first.
- #inspect ⇒ String (also: #to_s)
Methods inherited from Binary
Methods included from API
Methods included from Operations
Instance Method Details
#call!(state) {|if| ... } ⇒ Result
Succeeds if left or right succeeds Returns which ever succeeds first
35 36 37 38 39 40 41 |
# File 'lib/remap/mapper/or.rb', line 35 def call!(state, &error) left.call!(state) do |failure1| return right.call!(state) do |failure2| return error[failure1.merge(failure2)] end end end |
#inspect ⇒ String Also known as: to_s
44 45 46 |
# File 'lib/remap/mapper/or.rb', line 44 def inspect "%s | %s" % [left, right] end |