Class: Ok

Inherits:
Object
  • Object
show all
Includes:
ResultMethods
Defined in:
lib/result-monad/ok.rb

Instance Method Summary collapse

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