Class: Byebug::EvalCommand
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, register_setting_get, register_setting_set, register_setting_var, settings, settings_map, terminal_width
Class Method Details
.description ⇒ Object
51
52
53
54
55
56
57
|
# File 'lib/byebug/commands/eval.rb', line 51
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
47
48
49
|
# File 'lib/byebug/commands/eval.rb', line 47
def names
%w(p eval)
end
|
Instance Method Details
#execute ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/byebug/commands/eval.rb', line 33
def execute
expr = @match ? @match.post_match : @input
run_with_binding do |b|
if Command.settings[:stack_on_error]
print "#{bb_eval(expr, b).inspect}\n"
else
print "#{bb_warning_eval(expr, b).inspect}\n"
end
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
|