module Byebug::Skipper::Pry::ProcessorHacks

This is a monkey patch for Byebug::PryProcessor in order to add extra Byebug commands to Pry. This needs to be overriden because there is a hard-coded whitelist of ‘action` values inside, and I need to add custom actions.

Public Instance Methods

perform(action, options = {}) click to toggle source
Calls superclass method
# File lib/byebug/skipper/pry.rb, line 55
def perform(action, options = {})
  # If it's not one of our commands, short circuit and use the typical
  # behaviour.
  command = Byebug::Skipper::Pry::COMMANDS.find { _1.fetch(:cmd) == action.to_s }
  return super unless command

  # Call the Byebug command objects directly. This seems kind of fragile to
  # me, but I don't see any better options.
  Byebug::Skipper.const_get("#{command.fetch(:const_name)}Command")
    .new(self, action.to_s)
    .execute

  # This shows the REPL again, preventing execution from continuing.
  resume_pry unless command.fetch(:continues?)
end