Sha256: 2283da3a32567e9fd5d87c7ab5043c93836724b09c9ce017a630a1832a7f028e

Contents?: true

Size: 288 Bytes

Versions: 4

Compression:

Stored size: 288 Bytes

Contents

module Verbalize
  class Result < Array
    def initialize(outcome:, value:)
      super([outcome, value])
    end

    def succeeded?
      !failed?
    end

    def failed?
      outcome == :error
    end

    def outcome
      first
    end

    def value
      last
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
verbalize-1.1.1 lib/verbalize/result.rb
verbalize-1.0.1 lib/verbalize/result.rb
verbalize-1.0.0 lib/verbalize/result.rb
verbalize-0.1.0 lib/verbalize/result.rb