123456789_123456789_123456789_123456789_123456789_

Class: DEBUGGER__::CatchBreakpoint

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Breakpoint
Instance Chain:
Inherits: DEBUGGER__::Breakpoint
Defined in: lib/debug/breakpoint.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Breakpoint - Inherited

Color - Included

#color_pp

See additional method definition at line 50.

#colored_inspect,
#colorize

See additional method definition at line 36.

#colorize_blue,
#colorize_code

See additional method definition at line 79.

#colorize_cyan, #colorize_dim, #colorize_magenta,
#irb_colorize

See additional method definition at line 27.

#with_inspection_error_guard

SkipPathHelper - Included

Constructor Details

.new(pat, cond: nil, command: nil, path: nil) ⇒ CatchBreakpoint

[ GitHub ]

  
# File 'lib/debug/breakpoint.rb', line 305

def initialize pat, cond: nil, command: nil, path: nil
  @pat = pat.freeze
  @key = [:catch, @pat].freeze
  @last_exc = nil

  super(cond, command, path)
end

Instance Attribute Details

#last_exc (readonly)

[ GitHub ]

  
# File 'lib/debug/breakpoint.rb', line 303

attr_reader :last_exc

Instance Method Details

#description

[ GitHub ]

  
# File 'lib/debug/breakpoint.rb', line 337

def description
  "#{@last_exc.inspect} is raised."
end

#setup

[ GitHub ]

  
# File 'lib/debug/breakpoint.rb', line 313

def setup
  @tp = TracePoint.new(:raise){|tp|
    exc = tp.raised_exception
    next if SystemExit === exc
    next if skip_path?(tp.path)

    next if !safe_eval(tp.binding, @cond) if @cond
    should_suspend = false

    exc.class.ancestors.each{|cls|
      if @pat === cls.name
        should_suspend = true
        @last_exc = exc
        break
      end
    }
    suspend if should_suspend
  }
end

#to_s

[ GitHub ]

  
# File 'lib/debug/breakpoint.rb', line 333

def to_s
  "#{generate_label("Catch")} #{@pat.inspect}"
end