Sha256: aa24eabfe109e0ba4e990bf783bbf757e6254b64fab16feada98218c91ce5bdc

Contents?: true

Size: 342 Bytes

Versions: 2

Compression:

Stored size: 342 Bytes

Contents

class Tretry::Result
  attr_reader :error, :fails, :result

  def initialize(error:, fails:, result:)
    @error = error
    @fails = fails
    @result = result
  end

  def [](key)
    case key
    when :error
      error
    when :fails
      fails
    when :result
      result
    else
      raise "Unknown key: #{key}"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tretry-0.0.4 lib/tretry/result.rb
tretry-0.0.3 lib/tretry/result.rb