commit_transaction (Transaction::Simple)

    # File lib/transaction/simple.rb, line 264
      def commit_transaction(name = nil)
        raise Transaction::TransactionError, Transaction::Messages[:cannot_commit_no_transaction] if @__transaction_checkpoint__.nil?
        @__transaction_block__ ||= nil

        # Check to see if we are trying to commit a transaction that is outside
        # of the current transaction block. Otherwise, raise
        # TransactionCommitted if they are the same.
        if @__transaction_block__ and name
          nix = @__transaction_names__.index(name) + 1
          raise Transaction::TransactionError, Transaction::Messages[:cannot_commit_transaction_before_block] if nix < @__transaction_block__

          raise Transaction::TransactionCommitted if @__transaction_block__ == nix
        end

        raise Transaction::TransactionCommitted if @__transaction_block__ == @__transaction_level__

        if name.nil?
          ss = "" if Transaction::Simple.debugging?
          __commit_transaction
          Transaction::Simple.debug_io << "#{'<' * @__transaction_level__} " << "Commit Transaction#{ss}\n" if Transaction::Simple.debugging?
        else
          raise Transaction::TransactionError, Transaction::Messages[:cannot_commit_named_transaction] % name.inspect unless @__transaction_names__.include?(name)
          ss = "(#{name})" if Transaction::Simple.debugging?

          while @__transaction_names__[-1] != name
            Transaction::Simple.debug_io << "#{'<' * @__transaction_level__} " << "Commit Transaction#{ss}\n" if Transaction::Simple.debugging?
            __commit_transaction
          end
          Transaction::Simple.debug_io << "#{'<' * @__transaction_level__} " << "Commit Transaction#{ss}\n" if Transaction::Simple.debugging?
          __commit_transaction
        end

        self
      end