Module: StackDeck::ExceptionSupport
- Included in:
- Exception
- Defined in:
- lib/stackdeck/exception.rb
Instance Method Summary collapse
- #append_to_stack_deck(frames) ⇒ Object
- #copy_ruby_stack_to_deck(ignored_part = caller) ⇒ Object
- #higher_stack_deck ⇒ Object
- #set_backtrace_from_stack_deck! ⇒ Object
- #set_backtrace_with_stack_deck(frames) ⇒ Object
- #stack_deck(stop_at_boundary = true) ⇒ Object
Instance Method Details
#append_to_stack_deck(frames) ⇒ Object
5 6 7 8 |
# File 'lib/stackdeck/exception.rb', line 5 def append_to_stack_deck(frames) higher_stack_deck.concat(frames) set_backtrace_from_stack_deck! end |
#copy_ruby_stack_to_deck(ignored_part = caller) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/stackdeck/exception.rb', line 19 def copy_ruby_stack_to_deck(ignored_part=caller) @stack_deck_backtrace_remaining ||= backtrace upper_backtrace, lower_backtrace = StackDeck.split_list(@stack_deck_backtrace_remaining, ignored_part) higher_stack_deck.concat StackDeck::Frame::Ruby.extract(upper_backtrace) @stack_deck_backtrace_remaining = lower_backtrace set_backtrace_from_stack_deck! end |
#higher_stack_deck ⇒ Object
4 |
# File 'lib/stackdeck/exception.rb', line 4 def higher_stack_deck; @higher_stack_deck ||= []; end |
#set_backtrace_from_stack_deck! ⇒ Object
26 27 28 29 |
# File 'lib/stackdeck/exception.rb', line 26 def set_backtrace_from_stack_deck! @stack_deck_backtrace_remaining ||= backtrace set_backtrace_without_stack_deck stack_deck(false).map {|fr| fr.to_s } end |
#set_backtrace_with_stack_deck(frames) ⇒ Object
30 31 32 33 34 |
# File 'lib/stackdeck/exception.rb', line 30 def set_backtrace_with_stack_deck(frames) @stack_deck_backtrace_remaining = nil @higher_stack_deck = [] set_backtrace_without_stack_deck frames end |
#stack_deck(stop_at_boundary = true) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/stackdeck/exception.rb', line 9 def stack_deck(stop_at_boundary=true) deck = [] deck.concat(internal_stack_deck || []) if respond_to? :internal_stack_deck deck.concat higher_stack_deck remainder = @stack_deck_backtrace_remaining || backtrace deck.concat StackDeck::Frame::Ruby.extract(remainder) if remainder deck.compact! StackDeck.apply_boundary!(deck) if stop_at_boundary deck end |