class Byebug::Skipper::StepsCommand::HackyProcessor
We need to hijack the at_line
method of the processor, to prevent it from running the REPL when we want it to skip that frame. Sneakily replaces the processor with this wrapped/delegated version, and then unwraps/undelegates when no longer necessary.
Public Class Methods
hack_into(context)
click to toggle source
# File lib/byebug/skipper/steps_command.rb, line 27 def self.hack_into(context) hack = new(context.send(:processor)) context.instance_variable_set(:@processor, hack) hack.skip_this_frame! end
Public Instance Methods
at_line()
click to toggle source
Calls superclass method
# File lib/byebug/skipper/steps_command.rb, line 42 def at_line if Byebug::Skipper.skip?(context.location) skip_this_frame! # don't stop, keep running else unhack! super # will stop and show REPL end end
skip_this_frame!()
click to toggle source
# File lib/byebug/skipper/steps_command.rb, line 37 def skip_this_frame! context.step_into(1, context.frame.pos) proceed! end
unhack!()
click to toggle source
# File lib/byebug/skipper/steps_command.rb, line 33 def unhack! context.instance_variable_set(:@processor, __getobj__) end