Class: Debugger::EvalCommand
Overview
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, method_missing, options
Class Method Details
.help(cmd) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/ruby-debug/commands/eval.rb', line 27
def help(cmd)
if cmd == 'p'
%{
p expression\tevaluate expression and print its value
}
else
%{
e[val] expression\tevaluate expression and print its value,
\t\t\talias for p.
e[val] on/off\t\twhen 'on', debugger will evaluate every unknown command.
}
end
end
|
.help_command ⇒ Object
23
24
25
|
# File 'lib/ruby-debug/commands/eval.rb', line 23
def help_command
%w|p eval|
end
|
Instance Method Details
#execute ⇒ Object
12
13
14
15
16
17
18
19
20
|
# File 'lib/ruby-debug/commands/eval.rb', line 12
def execute
if @match && @match[1] != 'p' && %w[on off].include?(@match[2])
self.class.unknown = @match[2] == 'on'
print "Evaluation of unknown command is #{self.class.unknown ? 'on': 'off'}.\n"
return
end
expr = @match ? @match.post_match : @input
print "%s\n", debug_eval(expr).inspect
end
|
#match(input) ⇒ Object
3
4
5
6
|
# File 'lib/ruby-debug/commands/eval.rb', line 3
def match(input)
@input = input
super
end
|
#regexp ⇒ Object
8
9
10
|
# File 'lib/ruby-debug/commands/eval.rb', line 8
def regexp
/^\s*(p|e(?:val)?)(?:\s+(on|off)$|\s+)/
end
|