Sha256: af055ecf0ac490e45b70a3b6bf55b54dd9753b296ee3daf541d68e743eb0c259

Contents?: true

Size: 920 Bytes

Versions: 9

Compression:

Stored size: 920 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)
            arguments = transaction_options ? [transaction_method, transaction_options] : [transaction_method]
            transaction_class.send(*arguments) 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

          def transaction_options
            config.transaction_options
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
opera-0.2.9 lib/opera/operation/instructions/executors/transaction.rb
opera-0.2.8 lib/opera/operation/instructions/executors/transaction.rb
opera-0.2.7 lib/opera/operation/instructions/executors/transaction.rb
opera-0.2.6 lib/opera/operation/instructions/executors/transaction.rb
opera-0.2.5 lib/opera/operation/instructions/executors/transaction.rb
opera-0.2.4 lib/opera/operation/instructions/executors/transaction.rb
opera-0.2.3 lib/opera/operation/instructions/executors/transaction.rb
opera-0.2.2 lib/opera/operation/instructions/executors/transaction.rb
opera-0.2.1 lib/opera/operation/instructions/executors/transaction.rb