Class: Byebug::PPCommand
- Includes:
- EvalFunctions
- Defined in:
- lib/byebug/commands/eval.rb
Overview
Evaluation and pretty printing from byebug’s prompt.
Class Method Summary collapse
Instance Method Summary collapse
Methods included from EvalFunctions
#allowing_other_threads, #eval_with_setting, #run_with_binding
Methods inherited from Command
commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, #match
Methods included from StringFunctions
Methods included from FileFunctions
#get_line, #get_lines, #n_lines, #normalize
Methods included from ParseFunctions
#get_int, #parse_steps, #syntax_valid?
Constructor Details
This class inherits a constructor from Byebug::Command
Class Method Details
.description ⇒ Object
128 129 130 131 132 133 134 |
# File 'lib/byebug/commands/eval.rb', line 128 def description prettify " pp <expression>\n\n Evaluates <expression> and pretty-prints its value.\n EOD\nend\n" |
.names ⇒ Object
124 125 126 |
# File 'lib/byebug/commands/eval.rb', line 124 def names %w(pp) end |
Instance Method Details
#execute ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/byebug/commands/eval.rb', line 109 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. end |
#regexp ⇒ Object
105 106 107 |
# File 'lib/byebug/commands/eval.rb', line 105 def regexp /^\s* pp \s+/x end |