Class: Debugger::CatchCommand

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

Overview

:nodoc:

Constant Summary

Constants inherited from Command

Debugger::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

Class Method Details

.help(cmd) ⇒ Object



32
33
34
35
36
37
# File 'lib/ruby-debug/commands/catchpoint.rb', line 32

def help(cmd)
  %{
    cat[ch]\t\t\tshow catchpoint
    cat[ch] <an Exception>\tset catchpoint to an exception
  }
end

.help_commandObject



28
29
30
# File 'lib/ruby-debug/commands/catchpoint.rb', line 28

def help_command
  'catch'
end

Instance Method Details

#executeObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ruby-debug/commands/catchpoint.rb', line 9

def execute
  if excn = @match[1]
    if excn == 'off'
      Debugger.catchpoint = nil
      print "Clear catchpoint.\n"
    else
      Debugger.catchpoint = excn
      print "Set catchpoint %s.\n", excn
    end
  else
    if Debugger.catchpoint
      print "Catchpoint %s.\n", Debugger.catchpoint
    else
      print "No catchpoint.\n"
    end
  end
end

#regexpObject



5
6
7
# File 'lib/ruby-debug/commands/catchpoint.rb', line 5

def regexp
  /^\s*cat(?:ch)?(?:\s+(.+))?$/
end