Sha256: ff03fef409f50059aa995e1276f0bb5d1ac70a463a657d4b33badf000a11a53f

Contents?: true

Size: 421 Bytes

Versions: 3

Compression:

Stored size: 421 Bytes

Contents

module Flows
  class Result
    # Wrapper for failure results
    class Err < Result
      attr_reader :error

      def initialize(data, status: :failure, meta: {})
        @error = data
        @status = status
        @meta = meta
      end

      def ok?
        false
      end

      def err?
        true
      end

      def unwrap
        raise UnwrapError.new(@status, @data, @meta)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flows-0.3.0 lib/flows/result/err.rb
flows-0.2.0 lib/flows/result/err.rb
flows-0.1.0 lib/flows/result/err.rb