Sha256: 7d7cc6bd3ec0b9b6acd988f11917faa71c083b6a6d3688f1b705f1a8d94492db

Contents?: true

Size: 499 Bytes

Versions: 3

Compression:

Stored size: 499 Bytes

Contents

require "dry/monads/either"

module Dry
  module Transaction
    class StepAdapters
      # @api private
      class Raw
        include Dry::Monads::Either::Mixin

        def call(step, input, *args)
          result = step.operation.call(input, *args)

          unless result.is_a?(Dry::Monads::Either)
            raise ArgumentError, "step +#{step.step_name}+ must return an Either object"
          end

          result
        end
      end

      register :step, Raw.new
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dry-transaction-0.10.2 lib/dry/transaction/step_adapters/raw.rb
dry-transaction-0.10.1 lib/dry/transaction/step_adapters/raw.rb
dry-transaction-0.10.0 lib/dry/transaction/step_adapters/raw.rb