Class: Ok
Instance Method Summary collapse
- #handle_result(success_handler, failure_handler) ⇒ Object
-
#initialize(result) ⇒ Ok
constructor
A new instance of Ok.
Methods included from ResultMethods
#and_then, #error?, #flat_map, #flat_map_unsafe, #join, #map, #map_err, #map_unsafe, #ok?, #or_else, #to_s, #unwrap
Constructor Details
#initialize(result) ⇒ Ok
Returns a new instance of Ok.
5 6 7 |
# File 'lib/result-monad/ok.rb', line 5 def initialize(result) @result = result end |
Instance Method Details
#handle_result(success_handler, failure_handler) ⇒ Object
9 10 11 |
# File 'lib/result-monad/ok.rb', line 9 def handle_result(success_handler, failure_handler) success_handler.call(@result) end |