class Byebug::Command


Subclasses need to implement a ‘regexp` method and an `execute` method.
Parent class of all byebug commands.

def allow_in_post_mortem

def allow_in_post_mortem
  !defined?(@allow_in_post_mortem) ? true : false
end

def always_run

def always_run
  @always_run ||= 0
end

def bb_eval(str, b = get_binding)


error full stack trace and error are printed.
Evaluates a string containing Ruby code, using binding +b+. In case of
def bb_eval(str, b = get_binding)
  b.eval(str)
rescue StandardError, ScriptError => e
  at = e.backtrace
  locations = []
  locations << "#{at.shift}: #{e.class} Exception(#{e.message})"
  locations += at.map { |path| "\tfrom #{path}" }
  errmsg(pr('eval.exception', text_message: locations.join("\n")))
  nil
end

def bb_warning_eval(str, b = get_binding)


error, an error message with the exception is printed.
Evaluates a string containing Ruby code, using binding +b+. In case of
def bb_warning_eval(str, b = get_binding)
  b.eval(str)
rescue StandardError, ScriptError => e
  text_message = "#{e.class} Exception: #{e.message}"
  errmsg(pr('eval.exception', text_message: text_message))
  nil
end

def get_binding(pos = @state.frame)

def get_binding(pos = @state.frame)
  @state.context ? @state.context.frame_binding(pos) : TOPLEVEL_BINDING
end

def help


Default help text for a command.
def help
  prettify(description)
end

def initialize(state)

def initialize(state)
  @match = nil
  @state = state
end

def match(input)

def match(input)
  @match = regexp.match(input)
end

def subcommands


A subcommand is any class defined inside the parent's command class

Available subcommands for the current command
def subcommands
  const_list = constants(false).map { |const| const_get(const, false) }
  const_list.select { |c| c.is_a?(Class) }
end

def to_name


Name of the command, as executed by the user.
def to_name
  name.gsub(/^Byebug::/, '').gsub(/Command$/, '').downcase
end