Sha256: fe3c927421a787bf1676924cc04a88518ace40dce86b0c180df7f8786fee7329

Contents?: true

Size: 483 Bytes

Versions: 2

Compression:

Stored size: 483 Bytes

Contents

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

2 entries across 2 versions & 1 rubygems

Version Path
dry-transaction-0.13.0 lib/dry/transaction/step_failure.rb
dry-transaction-0.12.1 lib/dry/transaction/step_failure.rb