Sha256: 3109a8e5cadba7d638e0bb9d19847bcd1808272ea3814c5ccd7a10a1b0246194

Contents?: true

Size: 344 Bytes

Versions: 2

Compression:

Stored size: 344 Bytes

Contents

module ResultMethods
  def map
    return self if self.class == Resultt::Error

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

  def map_error
    return self if self.class == Resultt::Success

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
resultt-1.0.0 lib/resultt/result_methods.rb
resultt-0.1.0 lib/resultt/result_methods.rb