Exception: Exception
- Defined in:
- lib/core_ext/exception.rb
Overview
From utilrb’s full_message.rb, utilrb.rubyforge.org/ gitorious.org/+rock-core-maintainers/orocos-toolchain/rock-utilrb
Copyright © 2006-2008 Sylvain Joyeux <[email protected]> LAAS/CNRS <[email protected]>
Released under the BSD license, gitorious.org/+rock-core-maintainers/orocos-toolchain/rock-utilrb/blobs/master/License.txt
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#full_message(options = {}, &block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/core_ext/exception.rb', line 12 def ( = {}, &block) since_matches, until_matches = [:since], [:until] trace = backtrace if since_matches || until_matches found_beginning, found_end = !since_matches, false trace = trace.find_all do |line| found_beginning ||= (line =~ since_matches) found_end ||= (line =~ until_matches) if until_matches found_beginning && !found_end end end first, *remaining = if block_given? then trace.find_all(&block) else trace end msg = "#{first}: #{} (#{self.class})" unless remaining.empty? msg << "\n\tfrom " + remaining.join("\n\tfrom ") end msg end |