Sha256: f86221e76415c0fa75f5a67a56eefdf9dcf8c8ee466fbcf74573fa2ad0fb25e0

Contents?: true

Size: 499 Bytes

Versions: 2

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, *args, input)
          result = step.operation.call(*args, input)

          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

2 entries across 2 versions & 1 rubygems

Version Path
dry-transaction-0.8.0 lib/dry/transaction/step_adapters/raw.rb
dry-transaction-0.7.0 lib/dry/transaction/step_adapters/raw.rb