Class: Error

Inherits:
Object
  • Object
show all
Includes:
ResultMethods
Defined in:
lib/result-monad/error.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(err) ⇒ Error

Returns a new instance of Error.



5
6
7
# File 'lib/result-monad/error.rb', line 5

def initialize(err)
  @err = err
end

Instance Method Details

#handle_result(success_handler, failure_handler) ⇒ Object



9
10
11
# File 'lib/result-monad/error.rb', line 9

def handle_result(success_handler, failure_handler)
  failure_handler.call(@err)
end