Sha256: 2584652abf16a4089adaa0cad2aaf327c28949cef12e81d015e4a009bbf01060

Contents?: true

Size: 729 Bytes

Versions: 4

Compression:

Stored size: 729 Bytes

Contents

# frozen_string_literal: true

module Opera
  module Operation
    module Instructions
      module Executors
        class Transaction < Executor
          class RollbackTransactionError < Opera::Error; end

          def call(instruction)
            transaction_class.send(transaction_method) do
              super

              return if !operation.finished? && result.success?

              raise(RollbackTransactionError)
            end
          rescue RollbackTransactionError
            nil
          end

          def transaction_class
            config.transaction_class
          end

          def transaction_method
            config.transaction_method
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
opera-0.2.0 lib/opera/operation/instructions/executors/transaction.rb
opera-0.1.2 lib/opera/operation/instructions/executors/transaction.rb
opera-0.1.1 lib/opera/operation/instructions/executors/transaction.rb
opera-0.1.0 lib/opera/operation/instructions/executors/transaction.rb