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, #find, inherited, #initialize, load_commands, method_missing, options, register_setting_get, register_setting_set, register_setting_var, settings, settings_map
Class Method Details
.help(cmd) ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/ruby-debug/commands/eval.rb', line 57
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.
* NOTE - to turn on autoeval, use 'set autoeval'
}
end
end
|
.help_command ⇒ Object
53
54
55
|
# File 'lib/ruby-debug/commands/eval.rb', line 53
def help_command
%w|p eval|
end
|
Instance Method Details
#execute ⇒ Object
45
46
47
48
49
50
|
# File 'lib/ruby-debug/commands/eval.rb', line 45
def execute
expr = @match ? @match.post_match : @input
run_with_binding do |b|
print pr("eval.result", expr: expr, result: debug_eval(expr, b).inspect)
end
end
|
#match(input) ⇒ Object
36
37
38
39
|
# File 'lib/ruby-debug/commands/eval.rb', line 36
def match(input)
@input = input
super
end
|
#regexp ⇒ Object
41
42
43
|
# File 'lib/ruby-debug/commands/eval.rb', line 41
def regexp
/^\s*(p|e(?:val)?)\s+/
end
|