Class: Byebug::DeleteCommand

Inherits:
Command
  • Object
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, format_subcmd, format_subcmds, help, 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 Byebug::Command

Class Method Details

.descriptionObject



134
135
136
137
138
139
# File 'lib/byebug/commands/breakpoints.rb', line 134

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

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

.namesObject



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

def names
  %w(delete)
end

Instance Method Details

#executeObject



114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/byebug/commands/breakpoints.rb', line 114

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



110
111
112
# File 'lib/byebug/commands/breakpoints.rb', line 110

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