Class: Kind::Result::Failure
- Inherits:
-
Result::Monad
- Object
- Result::Monad
- Kind::Result::Failure
- Defined in:
- lib/kind/result/failure.rb
Constant Summary collapse
- DEFAULT_TYPE =
:error
Instance Method Summary collapse
- #failure? ⇒ Boolean
- #inspect ⇒ Object
- #map(_ = UNDEFINED, &_fn) ⇒ Object (also: #|, #>>, #map!, #then, #then!, #and_then, #and_then!)
- #value_or(default = UNDEFINED, &block) ⇒ Object
Instance Method Details
#inspect ⇒ Object
29 30 31 |
# File 'lib/kind/result/failure.rb', line 29 def inspect '#<%s type=%p value=%p>' % ['Kind::Failure', type, value] end |
#map(_ = UNDEFINED, &_fn) ⇒ Object Also known as: |, >>, map!, then, then!, and_then, and_then!
17 18 19 |
# File 'lib/kind/result/failure.rb', line 17 def map(_ = UNDEFINED, &_fn) self end |
#value_or(default = UNDEFINED, &block) ⇒ Object
11 12 13 14 15 |
# File 'lib/kind/result/failure.rb', line 11 def value_or(default = UNDEFINED, &block) Error.invalid_default_arg! if UNDEFINED == default && !block UNDEFINED != default ? default : block.call(value) end |