Sha256: 3757efb5d4a32f7ba151979c11c04d63608ffdf4ce735a28f7f9d25763a82175

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

# -*- coding: utf-8 -*-
# Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
require 'rubygems'; require 'require_relative'
require 'pp'
require_relative 'base/cmd'
class Trepan::Command::PPCommand < Trepan::Command

  unless defined?(HELP)
    NAME = File.basename(__FILE__, '.rb')
    HELP = 
      "#{NAME} EXPRESSION

Prtty Print the value of the EXPRESSION. Variables accessible are
those of the environment of the selected stack frame, plus globals.

If the length output string large, the first part of the value is
shown and ... indicates it has been truncated.

See 'set max string' to change the string truncation limit.
"
    CATEGORY      = 'data'
    SHORT_HELP    = 'pretty print expression truncating long output'
  end
  
  def run(args)
    obj = @proc.debug_eval(@proc.cmd_argstr)
    msg (obj.respond_to?(:pretty_inspect) ? obj.pretty_inspect : obj.inspect)
  end
end
        
if __FILE__ == $0
  require_relative '../mock'
  dbgr, cmd = MockDebugger::setup
  ['(0..10).to_a', '$LOADED_FEATURES'].each do |expr_str|
    cmd_argstr = expr_str
      cmd.proc.instance_variable_set('@cmd_argstr', cmd_argstr)
    cmd.run([cmd.name, cmd_argstr])
    puts '-' * 20
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rb8-trepanning-0.1.3 processor/command/pp.rb
rb8-trepanning-0.1.3-universal-ruby-1.9.2 processor/command/pp.rb
rb8-trepanning-0.1.3-universal-ruby-1.8.7 processor/command/pp.rb