Sha256: 8d72b1ff3bc5b0a3ffd21fa82e3766f9a16e03334d8b823e7f39bef300c9dba1

Contents?: true

Size: 514 Bytes

Versions: 4

Compression:

Stored size: 514 Bytes

Contents

# frozen_string_literal: true

module Dry
  module Transaction
    # A wrapper for storing together the step that failed
    # and value describing the failure.
    class StepFailure
      attr_reader :step
      attr_reader :value

      # @api private
      def self.call(step, value)
        if self === value
          value
        else
          yield
          new(step, value)
        end
      end

      def initialize(step, value)
        @step = step
        @value = value
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dry-transaction-0.14.0 lib/dry/transaction/step_failure.rb
dry-transaction-0.13.3 lib/dry/transaction/step_failure.rb
dry-transaction-0.13.2 lib/dry/transaction/step_failure.rb
dry-transaction-0.13.1 lib/dry/transaction/step_failure.rb