Class: Byebug::DeleteBreakpointCommand
- Inherits:
-
Command
- Object
- Command
- Byebug::DeleteBreakpointCommand
show all
- Defined in:
- lib/byebug/commands/breakpoints.rb
Overview
Implements byebug “delete” command.
Constant Summary
Constants inherited
from Command
Command::DEF_OPTIONS
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Command
commands, #find, inherited, #initialize, load_commands, #match, method_missing, options, register_setting_get, register_setting_set, register_setting_var, settings, settings_map
Class Method Details
.help(cmd) ⇒ Object
145
146
147
148
149
|
# File 'lib/byebug/commands/breakpoints.rb', line 145
def help(cmd)
%{
del[ete][ nnn...]\tdelete some or all breakpoints
}
end
|
.help_command ⇒ Object
141
142
143
|
# File 'lib/byebug/commands/breakpoints.rb', line 141
def help_command
'delete'
end
|
Instance Method Details
#execute ⇒ Object
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
# File 'lib/byebug/commands/breakpoints.rb', line 119
def execute
unless @state.context
errmsg "We are not in a state we can delete breakpoints.\n"
return
end
brkpts = @match[1]
unless brkpts
if confirm("Delete all breakpoints? (y or n) ")
Byebug.breakpoints.clear
end
else
brkpts.split(/[ \t]+/).each do |pos|
pos = get_int(pos, "Delete", 1)
return unless pos
unless Byebug.remove_breakpoint(pos)
errmsg "No breakpoint number %d\n", pos
end
end
end
end
|
#regexp ⇒ Object
115
116
117
|
# File 'lib/byebug/commands/breakpoints.rb', line 115
def regexp
/^\s *del(?:ete)? (?:\s+(.*))?$/ix
end
|