class Byebug::PPCommand - byebug-4.0.5 Documentation

# class Byebug::PPCommand

Evaluation and pretty printing from byebug's prompt.

### Public Class Methods

description() click to toggle source

    # File lib/byebug/commands/eval.rb, line 128
    def description
      prettify <<-EOD
        pp <expression>

        Evaluates <expression> and pretty-prints its value.
      EOD
    end

names() click to toggle source

    # File lib/byebug/commands/eval.rb, line 124
    def names
      %w(pp)
    end

### Public Instance Methods

execute() click to toggle source

    # 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.message
    end

regexp() click to toggle source

    # File lib/byebug/commands/eval.rb, line 105
    def regexp
      /^\s* pp \s+/x
    end