Class: Kind::Result::Failure
Constant Summary collapse
- DEFAULT_TYPE =
:error
Instance Attribute Summary
Attributes inherited from Monad
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
Methods inherited from Monad
#===, [], #initialize, #on, #on_failure, #on_success
Methods included from Abstract
#failed?, #on, #on_failure, #on_success, #result?, #succeeded?, #success?, #to_ary
Constructor Details
This class inherits a constructor from Kind::Result::Monad
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 |