Class: Byebug::DisableCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/byebug/commands/enable.rb

Constant Summary collapse

Subcommands =
[
   ['breakpoints', 1, 'Disable some breakpoints',
    'Arguments are breakpoint numbers with spaces in between. A disabled ' \
    'breakpoint is not forgotten, but has no effect until reenabled.'],
   ['display', 1, 'Disable some display expressions when program stops',
    'Arguments are the code numbers of the expressions to stop '       \
    'displaying. Do "info display" to see the current list of code ' \
    'numbers.'],
  ].map do |name, min, short_help, long_help|
  SubcmdStruct.new(name, min, short_help, long_help)
end

Constants inherited from Command

Command::DEF_OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

command_exists?, commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, load_commands, #match, method_missing, options, register_setting_get, register_setting_set, register_setting_var, settings, settings_map, terminal_width

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



145
146
147
148
149
150
# File 'lib/byebug/commands/enable.rb', line 145

def description
  %{Disable some things.

    A disabled item is not forgotten, but has no effect until reenabled.
    Use the "enable" command to have it take effect again.}
end

.namesObject



141
142
143
# File 'lib/byebug/commands/enable.rb', line 141

def names
  %w(disable)
end

Instance Method Details

#disable_breakpoints(args) ⇒ Object



132
133
134
# File 'lib/byebug/commands/enable.rb', line 132

def disable_breakpoints(args)
  enable_disable_breakpoints('Disable', args)
end

#disable_display(args) ⇒ Object



136
137
138
# File 'lib/byebug/commands/enable.rb', line 136

def disable_display(args)
  enable_disable_display('Disable', args)
end

#executeObject



118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/byebug/commands/enable.rb', line 118

def execute
  return errmsg "\"disable\" must be followed by \"display\", " \
                "\"breakpoints\" or breakpoint numbers.\n" unless @match[1]

  args = @match[1].split(/[ \t]+/)
  param = args.shift
  subcmd = Command.find(Subcommands, param)
  if subcmd
    send("disable_#{subcmd.name}", args)
  else
    send('disable_breakpoints', args.unshift(param))
  end
end

#regexpObject



114
115
116
# File 'lib/byebug/commands/enable.rb', line 114

def regexp
  /^\s* dis(?:able)? (?:\s+(.*))?$/ix
end