Sha256: 336c23ccd393a91f3699b263e7b17dbba2c6c72d7938d25ed620d120fea54bce

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

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

  unless defined?(HELP)
    NAME = File.basename(__FILE__, '.rb')
    HELP = <<-HELP
**#{NAME}** *Ruby-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 also:
---------
`set max string` to change the string truncation limit.
HELP
    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

4 entries across 4 versions & 1 rubygems

Version Path
trepanning-2.15.35 processor/command/pp.rb
trepanning-1.93.35 processor/command/pp.rb
trepanning-2.15.33 processor/command/pp.rb
trepanning-1.93.32 processor/command/pp.rb