# File lib/transaction/simple.rb, line 426
426:     def abort_transaction(name = nil)
427:       if @__transaction_checkpoint__.nil?
428:         raise TransactionError, Messages[:cannot_abort_no_transaction]
429:       end
430: 
431:         # Check to see if we are trying to abort a transaction that is
432:         # outside of the current transaction block. Otherwise, raise
433:         # TransactionAborted if they are the same.
434:       if @__transaction_block__ and name
435:         nix = @__transaction_names__.index(name) + 1
436:         if nix < @__transaction_block__
437:           raise TransactionError, Messages[:cannot_abort_transaction_before_block]
438:         end
439: 
440:         raise TransactionAborted if @__transaction_block__ == nix
441:       end
442: 
443:       raise TransactionAborted if @__transaction_block__ == @__transaction_level__
444: 
445:       if name.nil?
446:         __abort_transaction(name)
447:       else
448:         unless @__transaction_names__.include?(name)
449:           raise TransactionError, Messages[:cannot_abort_named_transaction] % name.inspect
450:         end
451:         __abort_transaction(name) while @__transaction_names__.include?(name)
452:       end
453:       self
454:     end