Class: Byebug::DeleteCommand

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

Overview

Implements byebug “delete” command.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

command_exists?, commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, load_commands, #match, register_setting_get, register_setting_set, register_setting_var, settings, settings_map, terminal_width

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



128
129
130
131
132
133
# File 'lib/byebug/commands/breakpoints.rb', line 128

def description
  %{del[ete][ nnn...]

    Without and argument, deletes all breakpoints. With integer arguments,
    it deletes specific breakpoints.}
end

.namesObject



124
125
126
# File 'lib/byebug/commands/breakpoints.rb', line 124

def names
  %w(delete)
end

Instance Method Details

#executeObject



108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/byebug/commands/breakpoints.rb', line 108

def execute
  return errmsg "We are not in a state we can delete breakpoints.\n" unless
    @state.context

  if not @match[1]
    Byebug.breakpoints.clear if confirm("Delete all breakpoints? (y or n) ")
  else
    @match[1].split(/[ \t]+/).each do |pos|
      return unless pos = get_int(pos, "Delete", 1)
      errmsg "No breakpoint number %d\n", pos unless
        Byebug.remove_breakpoint(pos)
    end
  end
end

#regexpObject



104
105
106
# File 'lib/byebug/commands/breakpoints.rb', line 104

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