Class: Debugger::CatchCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/ruby-debug-ide/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, #find, 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



40
41
42
43
44
45
# File 'lib/ruby-debug-ide/commands/catchpoint.rb', line 40

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

.help_commandObject



36
37
38
# File 'lib/ruby-debug-ide/commands/catchpoint.rb', line 36

def help_command
  'catch'
end

Instance Method Details

#executeObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ruby-debug-ide/commands/catchpoint.rb', line 11

def execute
  excn = @match[1] 
  if not excn
    # No args given.
    errmsg "Exception class must be specified for 'catch' command"
  elsif not @match[2]
    # One arg given.
    if 'off' == excn
      Debugger.catchpoints.clear
    else
      Debugger.add_catchpoint(excn)
      print_catchpoint_set(excn)
    end
  elsif @match[2] != 'off'
    errmsg "Off expected. Got %s\n", @match[2]
  elsif Debugger.catchpoints.member?(excn)
    Debugger.catchpoints.delete(excn)
    print_catchpoint_set(excn)
    #print "Catch for exception %s removed.\n", excn
  else
    errmsg "Catch for exception %s not found.\n", excn
  end
end

#regexpObject



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

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