Class: Byebug::PPCommand
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, #match, register_setting_get, register_setting_set, register_setting_var, settings, settings_map, terminal_width
Class Method Details
.description ⇒ Object
87
88
89
|
# File 'lib/byebug/commands/eval.rb', line 87
def description
%{pp expression\tevaluate expression and pretty-print its value}
end
|
.names ⇒ Object
83
84
85
|
# File 'lib/byebug/commands/eval.rb', line 83
def names
%w(pp)
end
|
Instance Method Details
#execute ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/byebug/commands/eval.rb', line 68
def execute
out = StringIO.new
run_with_binding do |b|
if Command.settings[:stack_on_error]
PP.pp(bb_eval(@match.post_match, b), out)
else
PP.pp(bb_warning_eval(@match.post_match, b), out)
end
end
print out.string
rescue
out.puts $!.message
end
|
#regexp ⇒ Object
64
65
66
|
# File 'lib/byebug/commands/eval.rb', line 64
def regexp
/^\s* pp \s+/x
end
|