Sha256: 77400518d5ed68869c8d8a4448b39fe1651e167bf491207df7c9a0fd70bb9684

Contents?: true

Size: 550 Bytes

Versions: 4

Compression:

Stored size: 550 Bytes

Contents

# frozen_string_literal: true

require 'dry/monads/result'
require 'dry/transaction/errors'

module Dry
  module Transaction
    class StepAdapters
      # @api private
      class Around
        include Dry::Monads::Result::Mixin

        def call(operation, options, args, &block)
          result = operation.(*args, &block)

          unless result.is_a?(Dry::Monads::Result)
            raise InvalidResultError.new(options[:step_name])
          end

          result
        end
      end

      register :around, Around.new
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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