Class: Debugger::DeleteBreakpointCommand

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

Overview

:nodoc:

Constant Summary

Constants inherited from Command

Command::DEF_OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, inherited, #initialize, load_commands, #match, method_missing, options

Constructor Details

This class inherits a constructor from Debugger::Command

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Debugger::Command

Class Method Details

.help(cmd) ⇒ Object



119
120
121
122
123
# File 'lib/ruby-debug/commands/breakpoints.rb', line 119

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

.help_commandObject



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

def help_command
  'delete'
end

Instance Method Details

#executeObject



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/ruby-debug/commands/breakpoints.rb', line 98

def execute
  pos = @match[1]
  unless pos
    if confirm("Clear all breakpoints? (y/n) ")
      Debugger.breakpoints.clear
    end
  else
    pos = pos.to_i
    if b = Debugger.remove_breakpoint(pos)
      print_breakpoint_deleted b
    else
      print_error "Breakpoint %d is not defined", pos
    end
  end
end

#regexpObject



94
95
96
# File 'lib/ruby-debug/commands/breakpoints.rb', line 94

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