module ResultMethods

Public Instance Methods

map() { |value| ... } click to toggle source
# File lib/resultt/result_methods.rb, line 2
def map
  return self if self.class == Resultt::Error

  Resultt::Success.new yield value
rescue StandardError => e
  Resultt::Error.new(e)
end
map_error() { |error| ... } click to toggle source
# File lib/resultt/result_methods.rb, line 10
def map_error
  return self if self.class == Resultt::Success

  Resultt::Error.new yield error
rescue StandardError => e
  Resultt::Error.new(e)
end