Class: Byebug::PPCommand
Overview
Evaluation and pretty printing from byebug’s prompt.
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Command
commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, load_commands, #match
Class Method Details
.description ⇒ Object
88
89
90
91
92
|
# File 'lib/byebug/commands/eval.rb', line 88
def description
%(pp <expression>
Evaluates <expression> and pretty-prints its value.)
end
|
.names ⇒ Object
84
85
86
|
# File 'lib/byebug/commands/eval.rb', line 84
def names
%w(pp)
end
|
Instance Method Details
#execute ⇒ Object
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/byebug/commands/eval.rb', line 69
def execute
out = StringIO.new
run_with_binding do |b|
if Setting[: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
puts out.string
rescue
out.puts $ERROR_INFO.message
end
|
#regexp ⇒ Object
65
66
67
|
# File 'lib/byebug/commands/eval.rb', line 65
def regexp
/^\s* pp \s+/x
end
|