Sha256: 7529c9f4b4e821682ca411427b6a588facde0a37d1419f25713f60c79a702837

Contents?: true

Size: 572 Bytes

Versions: 41

Compression:

Stored size: 572 Bytes

Contents

module Startback
  module Support
    class TransactionManager

      def initialize(db, method = :transaction)
        @db = db
        @method = method
      end

      def call(runner, op, &then_block)
        raise ArgumentError, "A block is required" unless then_block

        before = (op.class.transaction_policy == :before_call)
        if before
          @db.send(@method) do
            then_block.call
          end
        else
          then_block.call
        end
      end

    end # class TransactionManager
  end # module Support
end # module Startback

Version data entries

41 entries across 41 versions & 3 rubygems

Version Path
startback-1.0.3 lib/startback/support/transaction_manager.rb
startback-1.0.2 lib/startback/support/transaction_manager.rb
startback-1.0.1 lib/startback/support/transaction_manager.rb
startback-1.0.0 lib/startback/support/transaction_manager.rb
startback-0.19.4 lib/startback/support/transaction_manager.rb
startback-0.19.3 lib/startback/support/transaction_manager.rb
startback-0.19.1 lib/startback/support/transaction_manager.rb
startback-0.19.0 lib/startback/support/transaction_manager.rb
startback-0.18.2 lib/startback/support/transaction_manager.rb
startback-0.18.1 lib/startback/support/transaction_manager.rb
startback-0.18.0 lib/startback/support/transaction_manager.rb
startback-0.17.4 lib/startback/support/transaction_manager.rb
startback-0.17.3 lib/startback/support/transaction_manager.rb
startback-0.17.2 lib/startback/support/transaction_manager.rb
startback-0.17.1 lib/startback/support/transaction_manager.rb
startback-0.17.0 lib/startback/support/transaction_manager.rb
startback-0.16.0 lib/startback/support/transaction_manager.rb
startback-0.15.5 lib/startback/support/transaction_manager.rb
startback-0.15.4 lib/startback/support/transaction_manager.rb
startback-0.15.3 lib/startback/support/transaction_manager.rb