Class: Kleisli::Try
Defined Under Namespace
Instance Attribute Summary collapse
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Methods inherited from Monad
Methods inherited from Functor
Instance Attribute Details
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
6 7 8 |
# File 'lib/kleisli/try.rb', line 6 def exception @exception end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/kleisli/try.rb', line 6 def value @value end |
Class Method Details
.lift(f) ⇒ Object
8 9 10 11 12 |
# File 'lib/kleisli/try.rb', line 8 def self.lift(f) Success.new(f.call) rescue => e Failure.new(e) end |