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
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/ruby-debug/commands/eval.rb', line 25
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.
}
end
end
|
.help_command ⇒ Object
21
22
23
|
# File 'lib/ruby-debug/commands/eval.rb', line 21
def help_command
%w|p eval|
end
|
Instance Method Details
#execute ⇒ Object
14
15
16
17
18
|
# File 'lib/ruby-debug/commands/eval.rb', line 14
def execute
expr = @match ? @match.post_match : @input
binding = @state.context ? get_binding : TOPLEVEL_BINDING
print "%s\n", debug_eval(expr, binding).inspect
end
|
#match(input) ⇒ Object
5
6
7
8
|
# File 'lib/ruby-debug/commands/eval.rb', line 5
def match(input)
@input = input
super
end
|
#regexp ⇒ Object
10
11
12
|
# File 'lib/ruby-debug/commands/eval.rb', line 10
def regexp
/^\s*(p|e(?:val)?)\s+/
end
|