Class: Byebug::EvalCommand
Constant Summary
Constants inherited
from Command
Command::DEF_OPTIONS
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Command
commands, format_subcmd, format_subcmds, help, inherited, #initialize, load_commands, method_missing, options, register_setting_get, register_setting_set, register_setting_var, settings, settings_map
Class Method Details
.description ⇒ Object
60
61
62
63
64
65
|
# File 'lib/byebug/commands/eval.rb', line 60
def description
%{
(p|e[val]) expression\tevaluate expression and print its value
* NOTE - to turn on autoeval, use 'set autoeval'
}
end
|
.names ⇒ Object
56
57
58
|
# File 'lib/byebug/commands/eval.rb', line 56
def names
%w(p eval)
end
|
Instance Method Details
#execute ⇒ Object
48
49
50
51
52
53
|
# File 'lib/byebug/commands/eval.rb', line 48
def execute
expr = @match ? @match.post_match : @input
run_with_binding do |b|
print "#{debug_eval(expr, b).inspect}\n"
end
end
|
#match(input) ⇒ Object
39
40
41
42
|
# File 'lib/byebug/commands/eval.rb', line 39
def match(input)
@input = input
super
end
|
#regexp ⇒ Object
44
45
46
|
# File 'lib/byebug/commands/eval.rb', line 44
def regexp
/^\s*(p|e(?:val)?)\s+/
end
|