Class: Debugger::DeleteBreakpointCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/ruby-debug/commands/breakpoints.rb

Overview

Implements debugger “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

Constructor Details

This class inherits a constructor from Debugger::Command

Class Method Details

.help(cmd) ⇒ Object



144
145
146
147
148
# File 'lib/ruby-debug/commands/breakpoints.rb', line 144

def help(cmd)
  %{
    del[ete][ nnn...]\tdelete some or all breakpoints
  }
end

.help_commandObject



140
141
142
# File 'lib/ruby-debug/commands/breakpoints.rb', line 140

def help_command
  'delete'
end

Instance Method Details

#executeObject



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/ruby-debug/commands/breakpoints.rb', line 120

def execute
  brkpts = @match[1]
  unless brkpts
    if confirm(pr("breakpoints.confirmations.delete_all"))
      Debugger.breakpoints.clear
    end
  else
    brkpts.split(/[ \t]+/).each do |pos|
      pos = get_int(pos, "Delete", 1)
      return unless pos
      if Debugger.remove_breakpoint(pos)
        print pr("breakpoints.delete", id: pos)
      else
        errmsg pr("breakpoints.errors.no_breakpoint", id: pos)
      end
    end
  end
end

#regexpObject



116
117
118
# File 'lib/ruby-debug/commands/breakpoints.rb', line 116

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