Sha256: 15fa735192d3a8484c59ddc3baaa1d4741fe6e03947c18eb22ba6f46c684dac1

Contents?: true

Size: 729 Bytes

Versions: 3

Compression:

Stored size: 729 Bytes

Contents

# Copyright: Copyright (c) 2004  Nicolas Despres. All rights reserved.
# Author: Nicolas Despres  <polrop@lrde.epita.fr>.
# License: Gnu General Public License.

# $LastChangedBy: polrop $
# $Id: exception.rb 195 2005-04-11 15:00:45Z polrop $


class Exception

  #FIXME: write a ruby_pp which print exception backtrace exactly as ruby does
  #       by cuting long and repetitive backtrace.

  def long_pp
    str = short_pp + "\n"
    backtrace[1..-1].each { |x| str += "        from #{x}\n" }
    str.chomp
  end

  def short_pp
    exc_name = inspect.sub(/^#<(\w+):.+$/, '\1')
    if backtrace.nil?
      "#{self} (#{exc_name})"
    else
      "#{backtrace[0]}: #{self} (#{exc_name})"
    end
  end

end # class Exception



Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ttk-0.1.576 ruby_ex/exception.rb
ttk-0.1.580 ruby_ex/exception.rb
ttk-0.1.579 ruby_ex/exception.rb