class Byebug::PsCommand
Enhanced evaluation of expressions from byebug's prompt. Besides evaluating, it sorts and pretty prints arrays.
Public Class Methods
description()
click to toggle source
# File lib/byebug/commands/ps.rb, line 20 def self.description <<-EOD ps <expression> #{short_description} EOD end
regexp()
click to toggle source
# File lib/byebug/commands/ps.rb, line 16 def self.regexp /^\s* ps (\s+ (.+)) \s*$/x end
short_description()
click to toggle source
# File lib/byebug/commands/ps.rb, line 28 def self.short_description 'Evaluates an expression and prettyprints & sort the result' end
Public Instance Methods
execute()
click to toggle source
# File lib/byebug/commands/ps.rb, line 32 def execute return puts(help) unless @match[1] res = thread_safe_eval(@match[1]) res = res.sort if res.respond_to?(:sort) out = PP.pp(res, StringIO.new, Setting[:width]) print pr('eval.result', expr: @match[1], result: out.string) end