Class: Kind::Either::Monad::Wrapper
- Inherits:
-
Monad::Wrapper
- Object
- Monad::Wrapper
- Kind::Either::Monad::Wrapper
- Defined in:
- lib/kind/either/monad/wrapper.rb
Instance Method Summary collapse
Methods inherited from Monad::Wrapper
#initialize, #output, #output?
Constructor Details
This class inherits a constructor from Kind::Monad::Wrapper
Instance Method Details
#left(matcher = UNDEFINED) ⇒ Object
7 8 9 10 11 |
# File 'lib/kind/either/monad/wrapper.rb', line 7 def left(matcher = UNDEFINED) return if @monad.right? || output? @output = yield(@monad.value) if @monad.either?(matcher) end |
#right(matcher = UNDEFINED) ⇒ Object
13 14 15 16 17 |
# File 'lib/kind/either/monad/wrapper.rb', line 13 def right(matcher = UNDEFINED) return if @monad.left? || output? @output = yield(@monad.value) if @monad.either?(matcher) end |