I thought I might share this little piece of code that
generates a ‘lstree’-like output for class-hierarchy:
[snip helpful code]
Thank you. It’s very handy
Can you post this on wiki?
Cheers,
Simon
kind regards -botp
···
Simon Vandemoortele [mailto:deliriousNOSPAM@atchoo.be ] wrote:
Done !
The leading source for trustworthy and timely health and medical news and information. Providing credible health information, supportive community, and educational services by blending award-winning expertise in content, community services, expert...
Feel free to improve the code.
Greetz,
Simon
···
On Mon, 21 Apr 2003 18:19:25 +0900, Peña, Botp botp@delmonte-phil.com wrote:
Can you post this on wiki?
–
There are 10 types of people in the world…
those who understand binary and those who don’t.
simon, you may want to consider added a user page for yourself, and adding a
link the that page there - as i for one will NEVER remember that link
i put together an easy way to do this at
http://www.rubygarden.org/ruby?HowToCreateUserPages
(you just add your name to the list)
also, this page combines all the listings of HomePages and UserPages so it’s a
good central index - i don’t really know the history of both ‘User’ and
‘Home’.
you can also get to the page from the top level
http://www.rubygarden.org/ruby
-a
···
On Wed, 23 Apr 2003, Simon Vandemoortele wrote:
On Mon, 21 Apr 2003 18:19:25 +0900, Peña, Botp botp@delmonte-phil.com wrote:
Can you post this on wiki?
Done !
http://www.rubygarden.org/ruby?ASCIIClassHierarchyGenerator
Feel free to improve the code.
–
Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ara.t.howard@fsl.noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
====================================
daz
(daz)
27 April 2003 07:32
4
“Simon Vandemoortele” wrote
Can you post this on wiki?
http://www.rubygarden.org/ruby?ASCIIClassHierarchyGenerator
‘Stress-testing’, I tried …
classTree(Object)
→ : undefined method `instance_methods’ for nil (NoMethodError)
classTree(Kernel)
→ : undefined method `superclass’ for Kernel:Module (NoMethodError)
Both can be supported by a one-line (?wrapped? below) update …
methods = (current_root.instance_methods - begin
current_root.superclass.instance_methods rescue end).sort
Cheers,
daz
···
On Mon, 21 Apr 2003 18:19:25 +0900, Peña, Botp wrote:
–
n= 0x1397701A73D121E6E6EFD395340
s= (‘a’…‘z’).to_a.join << 'JARI ’
print s[n&31,1] until (n>>=5)==0
classTree(Object)
→ : undefined method `instance_methods’ for nil (NoMethodError)
Harry Olson caught this one too (see his solution in this thread).
classTree(Kernel)
→ : undefined method `superclass’ for Kernel:Module (NoMethodError)
Both can be supported by a one-line (?wrapped? below) update …
methods = (current_root.instance_methods - begin
current_root.superclass.instance_methods rescue end).sort
After adding ‘NameError’ behind ‘rescue’ this solution also works here.
I have updated the code on the Wiki page.
(Note that the latest version prints in color …)
Simon
···
On Sun, 27 Apr 2003 at 07:17 GMT, daz wrote:
There are 10 types of people in the world…
those who understand binary and those who don’t.
daz
(daz)
27 April 2003 12:33
6
classTree(Object)
→ : undefined method `instance_methods’ for nil (NoMethodError)
Harry Olson caught this one too (see his solution in this thread).
Oops, long thread and still 800 unread messages
After adding ‘NameError’ behind ‘rescue’ this solution also works
here.
I have updated the code on the Wiki page.
Glad I didn’t update the Wiki with a 1.7+ fix. Thanks.
classTree(File)
→ : :41:in `*': negative argument (ArgumentError)
maxlength = 0
… ‘nervously’ changed here to …
maxlength = root.to_s.length
… without fully understanding the consequences.
Cheers,
daz
···
“Simon Vandemoortele” deliriousNOSPAM@atchoo.be wrote:
On Sun, 27 Apr 2003 at 07:17 GMT, daz wrote: