lib/dm-transactions.rb
def within
      unless block_given?
        raise 'No block provided'
      end

      unless begin?
        raise "Illegal state for within: #{state}"
      end

      adapters = @adapters

      adapters.each_key do |adapter|
        adapter.push_transaction(self)
      end

      begin
        yield self
      ensure
        adapters.each_key do |adapter|
          adapter.pop_transaction
        end
      end
    end
def within
      unless block_given?
        raise 'No block provided'
      end

      unless begin?
        raise "Illegal state for within: #{state}"
      end

      adapters = @adapters

      adapters.each_key do |adapter|
        adapter.push_transaction(self)
      end

      begin
        yield self
      ensure
        adapters.each_key do |adapter|
          adapter.pop_transaction
        end
      end
    end
Execute a block within this Transaction.

 No #begin, #commit or #rollback is performed in #within, but this
 Transaction will pushed on the per thread stack of transactions for each
 adapter it is associated with, and it will ensures that it will pop the
 Transaction away again after the block is finished.

 @param block<Block> the block of code to execute.

 @api private