Sha256: ca773af1ae01bbd6a4fc9eb8abb0bb46f6ab448d499d72fa0e11ff83772ac947

Contents?: true

Size: 803 Bytes

Versions: 1

Compression:

Stored size: 803 Bytes

Contents

# $Id: bones.rake 105 2008-02-26 04:43:21Z tim_pease $

require 'pp'
require 'stringio'

namespace :bones do

  desc 'Show the PROJ open struct'
  task :debug do |t|
    atr = if ARGV.length == 2
      t.application.top_level_tasks.pop
    end
    sio = StringIO.new
    sep = "\n" + ' '*27
    fmt = "%23s => %s"

    if atr
      PP.pp(PROJ.send(atr.to_sym), sio, 49)
      sio.seek 0
      val = sio.read
      val = val.split("\n").join(sep)

      puts fmt % [atr, val]
    else
      h = PROJ.instance_variable_get(:@table)
      h.keys.map {|k| k.to_s}.sort.each do |k|
        sio.truncate 0
        PP.pp(h[k.to_sym], sio, 49)
        sio.seek 0
        val = sio.read
        val = val.split("\n").join(sep)

        puts fmt % [k, val]
      end
    end
  end

end  # namespace :bones

# EOF

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
logging-0.7.1 tasks/bones.rake