Class: Byebug::EvalCommand
Constant Summary
Constants inherited
from Command
Command::DEF_OPTIONS
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Command
command_exists?, commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, load_commands, method_missing, options, register_setting_get, register_setting_set, register_setting_var, settings, settings_map, terminal_width
Class Method Details
.description ⇒ Object
61
62
63
64
65
66
67
|
# File 'lib/byebug/commands/eval.rb', line 61
def description
%{(p|e[val]) expression
Evaluate expression and print its value
* NOTE - unknown input is automatically evaluated, to turn this off
use 'set noautoeval'}
end
|
.names ⇒ Object
57
58
59
|
# File 'lib/byebug/commands/eval.rb', line 57
def names
%w(p eval)
end
|
Instance Method Details
#execute ⇒ Object
49
50
51
52
53
54
|
# File 'lib/byebug/commands/eval.rb', line 49
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
40
41
42
43
|
# File 'lib/byebug/commands/eval.rb', line 40
def match(input)
@input = input
super
end
|
#regexp ⇒ Object
45
46
47
|
# File 'lib/byebug/commands/eval.rb', line 45
def regexp
/^\s*(p|e(?:val)?)\s+/
end
|