Sha256: 169d9844c04b6afb7c2d501982a128000d57059f9e727c55142fbabe1a8ce6bf
Contents?: true
Size: 743 Bytes
Versions: 4
Compression:
Stored size: 743 Bytes
Contents
# Copyright: Copyright (c) 2004 Nicolas Despres. All rights reserved. # Author: Nicolas Despres <polrop@lrde.epita.fr>. # License: Gnu General Public License. # $LastChangedBy: polrop $ # $Id: hierarchy.rb 145 2005-01-30 14:16:14Z polrop $ class Hash # Pretty print a hash symbolizing a class hierarchy. def pp_hierarchy(prefix=//, abstract=false) pp_hierarchy_rec('', prefix, abstract) end protected def pp_hierarchy_rec(indent, prefix, abstract) self.each do |k, v| k_str = k.to_s.sub(prefix, '') if abstract and k.abstract? puts "#{indent}/#{k_str}/" else puts "#{indent}#{k_str}" end v.pp_hierarchy_rec(indent + ' ', prefix, abstract) end end end # class Hash
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
ttk-0.1.576 | ruby_ex/pp_hierarchy.rb |
ttk-0.1.580 | ruby_ex/pp_hierarchy.rb |
ttk-0.1.579 | ruby_ex/pp_hierarchy.rb |
vcs-0.2.148 | ruby_ex/pp_hierarchy.rb |