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
47
48
49
50
51
52
53
|
# File 'lib/byebug/commands/eval.rb', line 47
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
43
44
45
|
# File 'lib/byebug/commands/eval.rb', line 43
def names
%w(p eval)
end
|
Instance Method Details
#execute ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'lib/byebug/commands/eval.rb', line 33
def execute
expr = @match ? @match.post_match : @input
run_with_binding do |b|
print "#{debug_eval(expr, b).inspect}\n"
end
rescue
print "#{$!.class} Exception: #{$!.message}\n"
end
|
#match(input) ⇒ Object
24
25
26
27
|
# File 'lib/byebug/commands/eval.rb', line 24
def match(input)
@input = input
super
end
|
#regexp ⇒ Object
29
30
31
|
# File 'lib/byebug/commands/eval.rb', line 29
def regexp
/^\s* (p|e(?:val)?)\s+/x
end
|