Class: DEBUGGER__::CatchBreakpoint
- Inherits:
-
Breakpoint
- Object
- Breakpoint
- DEBUGGER__::CatchBreakpoint
- Defined in:
- lib/debug/breakpoint.rb
Instance Attribute Summary collapse
-
#last_exc ⇒ Object
readonly
Returns the value of attribute last_exc.
Attributes inherited from Breakpoint
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(pat, cond: nil, command: nil, path: nil) ⇒ CatchBreakpoint
constructor
A new instance of CatchBreakpoint.
- #setup ⇒ Object
- #to_s ⇒ Object
Methods inherited from Breakpoint
#delete, #deleted?, #disable, #duplicable?, #enable, #enabled?, #generate_label, #oneshot?, #safe_eval, #skip_path?, #suspend
Methods included from Color
#color_pp, #colored_inspect, #colorize, #colorize_blue, #colorize_code, #colorize_cyan, #colorize_dim, #colorize_magenta, #irb_colorize, #with_inspection_error_guard
Methods included from SkipPathHelper
#skip_config_skip_path?, #skip_internal_path?, #skip_location?, #skip_path?
Constructor Details
#initialize(pat, cond: nil, command: nil, path: nil) ⇒ CatchBreakpoint
Returns a new instance of CatchBreakpoint.
305 306 307 308 309 310 311 |
# 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 ⇒ Object (readonly)
Returns the value of attribute last_exc.
303 304 305 |
# File 'lib/debug/breakpoint.rb', line 303 def last_exc @last_exc end |
Instance Method Details
#description ⇒ Object
337 338 339 |
# File 'lib/debug/breakpoint.rb', line 337 def description "#{@last_exc.inspect} is raised." end |
#setup ⇒ Object
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# 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 ⇒ Object
333 334 335 |
# File 'lib/debug/breakpoint.rb', line 333 def to_s "#{generate_label("Catch")} #{@pat.inspect}" end |