I was trying to come up with some example code for ‘prettyprint’ and I
remembered Hal’s class diagram. This is somewhat ugly in the details,
but it does show some 1.7/1.8 features: prettyprint, Hashes with blocks
for unknown values, and Enumerable#sort_by.
def print_children_of(pp, cls)
pp.group do
pp.text(cls.name)
pp.group do
kids = @children[cls].sort_by {|k| k.name}
unless kids.empty?
pp.text ’ ['
pp.nest(3) do
pp.breakable
kids.each do |k|
next if k == Exception || k.name =~ /^Pretty/
unless pp.first?
pp.text ','
pp.breakable
end
print_children_of(pp, k)
end
end
pp.breakable
pp.text ']'
end
end
end
end
But if you’re referring to the code that
outputs a class diagram in ASCII form,
that was someone else’s work.
Hmm, never heard of prettyprint. Is it
documented anywhere in English? (Yes, I
know it’s doumented in Ruby… :))
Hal
···
----- Original Message -----
From: “Dave Thomas” dave@pragprog.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Wednesday, May 14, 2003 10:48 PM
Subject: 1.8-intense class tree
I was trying to come up with some example code for ‘prettyprint’ and I
remembered Hal’s class diagram. This is somewhat ugly in the details,
but it does show some 1.7/1.8 features: prettyprint, Hashes with blocks
for unknown values, and Enumerable#sort_by.
De-lurk more often. I enjoy that kind of tidbit,
but it wasn’t what I was talking about.
I was asking about Ruby’s prettyprint. But
Tanaka Akira kindly pointed out what should
have been obvious to me – there’s some
documentation inside prettyprint.rb itself.
Cheers,
Hal
···
----- Original Message -----
From: “furlan primus” magicus23@yahoo.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Thursday, May 15, 2003 7:01 AM
Subject: Re: prettyprint
If you are referring to the idea of prettyprint then it goes back a bit
as I recall references to the term in:
Henry F. Ledgard and Louis J. Chmura
FORTRAN WITH STYLE Programming Proverbs
New Jersey: Hayden Books, 1978.
I am looking for my copy of the book to verify it. I need to get to
work at the moment and will get back to you tonight about it…