class Byebug::Command

Parent class of all byebug commands.

Subclass it and name the subclass ending with the word Command to implement your own custom command.

@example Define a custom command

class MyCustomCommand < Command

def self.regexp
  /custom_regexp/
end

def self.description
  "Custom long desc"
end

def.short_description
  "Custom short desc"
end

def execute
  # My command's implementation
end

end

Attributes

allow_in_control[RW]

Special methods to allow command filtering in processors

allow_in_post_mortem[RW]

Special methods to allow command filtering in processors

always_run[W]
processor[R]

Public Class Methods

always_run() click to toggle source
# File lib/byebug/command.rb, line 72
def always_run
  @always_run ||= 0
end
columnize(width) click to toggle source
# File lib/byebug/command.rb, line 87
def columnize(width)
  format(
    "  %-<name>#{width}s -- %<description>s\n",
    name: to_s,
    description: short_description
  )
end
help() click to toggle source

Default help text for a command.

# File lib/byebug/command.rb, line 98
def help
  prettify(description)
end
match(input) click to toggle source

Command's regexp match against an input

# File lib/byebug/command.rb, line 105
def match(input)
  regexp.match(input)
end
new(processor, input = self.class.to_s) click to toggle source
# File lib/byebug/command.rb, line 37
def initialize(processor, input = self.class.to_s)
  @processor = processor
  @match = match(input)
end
to_s() click to toggle source

Name of the command, as executed by the user.

# File lib/byebug/command.rb, line 79
def to_s
  name
    .split("::")
    .map { |n| n.gsub(/Command$/, "").downcase if /Command$/.match?(n) }
    .compact
    .join(" ")
end

Public Instance Methods

arguments() click to toggle source
# File lib/byebug/command.rb, line 50
def arguments
  @match[0].split(" ").drop(1).join(" ")
end
context() click to toggle source
# File lib/byebug/command.rb, line 42
def context
  @context ||= processor.context
end
frame() click to toggle source
# File lib/byebug/command.rb, line 46
def frame
  @frame ||= context.frame
end