Class: Byebug::DisableCommand

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

Constant Summary collapse

Subcommands =
[
  ['breakpoints', 1, 'Disable breakpoints. A disabled breakpoint is '   \
                     'not forgotten, but has no effect until '          \
                     'reenabled. Give breakpoint numbers (separated by' \
                     'spaces) as arguments or no argument at all if '   \
                     'you want to disable every breakpoint'               ],
  ['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, help|
  Subcmd.new(name, min, help)
end

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, load_commands, #match

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



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

def description
  %{Disable breakpoints or displays.

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

.namesObject



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

def names
  %w(disable)
end

Instance Method Details

#disable_breakpoints(args) ⇒ Object



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

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

#disable_display(args) ⇒ Object



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

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

#executeObject



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

def execute
  return errmsg "\"disable\" must be followed by \"display\", " \
                "\"breakpoints\" or breakpoint ids\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



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

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