Sha256: 95bcfcb09b5fc130c3de559e4116084ded9740f8e3bc6bcc7942645bf12077db

Contents?: true

Size: 394 Bytes

Versions: 2

Compression:

Stored size: 394 Bytes

Contents

module Dry
  module Transaction
    class StepAdapters
      # @api private
      class Check
        include Dry::Monads::Either::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

2 entries across 2 versions & 1 rubygems

Version Path
dry-transaction-0.11.1 lib/dry/transaction/step_adapters/check.rb
dry-transaction-0.11.0 lib/dry/transaction/step_adapters/check.rb