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

commands, help, inherited, #initialize, load_commands, #match, method_missing, options, register_setting_get, register_setting_set, register_setting_var, settings, settings_map

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



174
175
176
177
178
179
180
181
# File 'lib/byebug/commands/enable.rb', line 174

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



170
171
172
# File 'lib/byebug/commands/enable.rb', line 170

def names
  %w(disable)
end

Instance Method Details

#disable_breakpoints(args) ⇒ Object



149
150
151
# File 'lib/byebug/commands/enable.rb', line 149

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

#disable_display(args) ⇒ Object



153
154
155
# File 'lib/byebug/commands/enable.rb', line 153

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

#executeObject



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/byebug/commands/enable.rb', line 133

def execute
  if not @match[1]
    errmsg "\"disable\" must be followed by \"display\", \"breakpoints\" " \
           "or breakpoint numbers.\n"
  else
    args = @match[1].split(/[ \t]+/)
    param = args.shift
    subcmd = find(Subcommands, param)
    if subcmd
      send("disable_#{subcmd.name}", args)
    else
      send('disable_breakpoints', args.unshift(param))
    end
  end
end

#help(args) ⇒ Object



157
158
159
160
161
162
163
164
165
166
167
# File 'lib/byebug/commands/enable.rb', line 157

def help(args)
  if args[1]
    subcmd = find(Subcommands, args[1])
    return "Invalid \"disable\" subcommand \"#{args[1]}\"." unless subcmd

    str = subcmd.short_help + '.'
    str += '\n' + subcmd.long_help if subcmd.long_help
    return str
  end
  DisableCommand.description + format_subcmds(Subcommads)
end

#regexpObject



129
130
131
# File 'lib/byebug/commands/enable.rb', line 129

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