Class: Byebug::DeleteCommand

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, load_commands, #match

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



30
31
32
33
34
35
# File 'lib/byebug/commands/delete.rb', line 30

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

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

.namesObject



26
27
28
# File 'lib/byebug/commands/delete.rb', line 26

def names
  %w(delete)
end

Instance Method Details

#executeObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/byebug/commands/delete.rb', line 10

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



6
7
8
# File 'lib/byebug/commands/delete.rb', line 6

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