Class: Byebug::EnableDisableCommand
Overview
Enabling or disabling custom display expressions or breakpoints.
Constant Summary
collapse
- Subcommands =
[
['breakpoints', 2, 'Enable/disable breakpoints. Give breakpoint ' \
'numbers (separated by spaces) as arguments or no ' \
'argument at all if you want to enable/disable ' \
'every breakpoint'],
['display', 2, 'Enable/disable some expressions to be displayed when ' \
' when program stops. Arguments are the code numbers ' \
'of the expressions to resume/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
#enable_disable_breakpoints, #enable_disable_display
Methods inherited from Command
commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, #match
#camelize, #prettify
#get_line, #get_lines, #n_lines, #normalize
#get_int, #parse_steps, #syntax_valid?, #without_stderr
Class Method Details
.description ⇒ Object
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
# File 'lib/byebug/commands/enable_disable.rb', line 110
def description
prettify <<-EOD
(en|dis)[able][[ (breakpoints|display)][ n1[ n2[ ...[ nn]]]]]
Enables or disables breakpoints or displays.
"enable" by itself enables all breakpoints, just like
"enable breakpoints". On the other side, "disable" or
"disable breakpoints" disable all breakpoints.
You can also specify a space separated list of breakpoint numbers to
enable or disable specific breakpoints. You can use either
"enable <id1> ... <idn>" or "enable breakpoints <id1> ... <idn>" and
the same with "disable".
If instead of "breakpoints" you specify "display", the command will
work exactly the same way, but displays will get enabled/disabled
instead of breakpoints.
EOD
end
|
.names ⇒ Object
106
107
108
|
# File 'lib/byebug/commands/enable_disable.rb', line 106
def names
%w((en|dis)able)
end
|
Instance Method Details
#disable_breakpoints(args) ⇒ Object
97
98
99
|
# File 'lib/byebug/commands/enable_disable.rb', line 97
def disable_breakpoints(args)
enable_disable_breakpoints('disable', args)
end
|
#disable_display(args) ⇒ Object
101
102
103
|
# File 'lib/byebug/commands/enable_disable.rb', line 101
def disable_display(args)
enable_disable_display('disable', args)
end
|
#enable_breakpoints(args) ⇒ Object
89
90
91
|
# File 'lib/byebug/commands/enable_disable.rb', line 89
def enable_breakpoints(args)
enable_disable_breakpoints('enable', args)
end
|
#enable_display(args) ⇒ Object
93
94
95
|
# File 'lib/byebug/commands/enable_disable.rb', line 93
def enable_display(args)
enable_disable_display('enable', args)
end
|
#execute ⇒ Object
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/byebug/commands/enable_disable.rb', line 74
def execute
cmd = @match[1] == 'dis' ? 'disable' : 'enable'
return errmsg(pr('toggle.errors.syntax', toggle: cmd)) unless @match[2]
args = @match[2].split(/ +/)
param = args.shift
subcmd = Command.find(Subcommands, param)
if subcmd
send("#{cmd}_#{subcmd.name}", args)
else
send("#{cmd}_breakpoints", args.unshift(param))
end
end
|
#regexp ⇒ Object
70
71
72
|
# File 'lib/byebug/commands/enable_disable.rb', line 70
def regexp
/^\s* (dis|en)(?:able)? (?:\s+(.+))? \s*$/x
end
|