Method: Monadic::Either#or
- Defined in:
- lib/monadic/either.rb
#or(value = nil, &block) ⇒ Success, Failure
If it is a Failure it will return a new Failure with the provided value
39 40 41 42 43 |
# File 'lib/monadic/either.rb', line 39 def or(value=nil, &block) return Failure(block.call(@value)) if failure? && block_given? return Failure(value) if failure? return self end |