# class Byebug::PSCommand

Evaluation, pretty printing, columnizing and sorting from byebug's prompt

### Public Class Methods

description() click to toggle source

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

        Evaluates <expression>, an array, sort and columnize its value.
      EOD
    end

names() click to toggle source

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

### Public Instance Methods

execute() click to toggle source

    # File lib/byebug/commands/eval.rb, line 195
    def execute
      out = StringIO.new
      run_with_binding do |b|
        res = eval_with_setting(b, @match.post_match, Setting[:stack_on_error])

        if res.is_a?(Array)
          puts "#{columnize(res.map(&:to_s).sort!, Setting[:width])}"
        else
          PP.pp(res, out)
          puts out.string
        end
      end
    rescue
      out.puts $ERROR_INFO.message
    end

regexp() click to toggle source

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