Sha256: 2b188b39983aa5be1d6a5c0bf70e3265641a05c434a9fb9a4fcaf76bdf2cf307

Contents?: true

Size: 394 Bytes

Versions: 4

Compression:

Stored size: 394 Bytes

Contents

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

        def call(operation, _options, args)
          input = args[0]
          res = operation.(*args)
          res == true || res.is_a?(Success) ? Success(input) : Failure(input)
        end
      end

      register :check, Check.new
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dry-transaction-0.13.0 lib/dry/transaction/step_adapters/check.rb
dry-transaction-0.12.1 lib/dry/transaction/step_adapters/check.rb
dry-transaction-0.12.0 lib/dry/transaction/step_adapters/check.rb
dry-transaction-0.11.2 lib/dry/transaction/step_adapters/check.rb