Class: Debugger::Command
- Inherits:
-
Object
show all
- Defined in:
- lib/ruby-debug/command.rb
Overview
Direct Known Subclasses
AddBreakpoint, BreakpointsCommand, CatchCommand, ContinueCommand, DeleteBreakpointCommand, DownCommand, EvalCommand, FinishCommand, FrameCommand, InspectCommand, InterruptCommand, LoadCommand, NextCommand, PPCommand, QuitCommand, RestartCommand, StartCommand, StepCommand, ThreadCurrentCommand, ThreadListCommand, ThreadResumeCommand, ThreadStopCommand, ThreadSwitchCommand, UpCommand, VarConstantCommand, VarGlobalCommand, VarInstanceCommand, VarLocalCommand, WhereCommand
Constant Summary
collapse
- DEF_OPTIONS =
{
:event => true,
:control => false,
:unknown => false,
:need_context => false,
}
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(state, printer) ⇒ Command
Returns a new instance of Command.
46
47
48
|
# File 'lib/ruby-debug/command.rb', line 46
def initialize(state, printer)
@state, @printer = state, printer
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
56
57
58
59
60
61
62
|
# File 'lib/ruby-debug/command.rb', line 56
def method_missing(meth, *args, &block)
if @printer.respond_to? meth
@printer.send meth, *args, &block
else
super
end
end
|
Class Method Details
.commands ⇒ Object
4
5
6
|
# File 'lib/ruby-debug/command.rb', line 4
def commands
@commands ||= []
end
|
.inherited(klass) ⇒ Object
15
16
17
18
19
20
|
# File 'lib/ruby-debug/command.rb', line 15
def inherited(klass)
DEF_OPTIONS.each do |o, v|
klass.options[o] = v if klass.options[o].nil?
end
commands << klass
end
|
.load_commands ⇒ Object
22
23
24
25
26
27
|
# File 'lib/ruby-debug/command.rb', line 22
def load_commands
dir = File.dirname(__FILE__)
Dir[File.join(dir, 'commands', '*')].each do |file|
require file if file =~ /\.rb$/
end
end
|
.method_missing(meth, *args, &block) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/ruby-debug/command.rb', line 29
def method_missing(meth, *args, &block)
if meth.to_s =~ /^(.+?)=$/
@options[$1.intern] = args.first
else
if @options.has_key?(meth)
@options[meth]
else
super
end
end
end
|
.options ⇒ Object
41
42
43
|
# File 'lib/ruby-debug/command.rb', line 41
def options
@options ||= {}
end
|
Instance Method Details
#match(input) ⇒ Object
50
51
52
|
# File 'lib/ruby-debug/command.rb', line 50
def match(input)
@match = regexp.match(input)
end
|