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