Sha256: 2bbbedf0ed977e5b180ccd2501161cd684bf4ae56c26ea3da6625a7cd6d164cd

Contents?: true

Size: 755 Bytes

Versions: 1

Compression:

Stored size: 755 Bytes

Contents

# Copyright:: Copyright (c) 2004  Nicolas Despres. All rights reserved.
# Author::    Nicolas Despres  <polrop@lrde.epita.fr>.
# License::   Gnu General Public License.
# Revision::  $Id: exception.rb 200 2005-04-22 22:55:31Z ertai $


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" } if backtrace
    str.chomp!
    str
  end

  def short_pp
    if backtrace.nil?
      tiny_pp
    else
      "#{backtrace[0]}: #{tiny_pp}"
    end
  end

  def tiny_pp
    exc_name = inspect.sub(/^#<(\w+):.+$/, '\1')
    "#{self} (#{exc_name})"
  end

end # class Exception

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vcs-0.2.148 ruby_ex/exception.rb