From: RichardOnRails Date: 2008-09-13T12:13:11+09:00 Subject: Finding parent-class hierarchy recursively Hi, I wrote a method to display a class' "parentage" based on an idea in "Ruby Cookbook", sec. 10.1: def parents(obj) ( (obj.superclass ? parents(obj.superclass) : []) << obj). reverse end I displayed Class' parent-class hierarchy with: Class.superclass.inspect => Module Module.superclass.inspect => Object Object.superclass.inspect => nil Then I tested the automatic generation of that hierarchy as follows: parents(Class).inspect => [Class, Object, Module] Expected: [Class, Module, Object] I tried display intermediate values during the recursion, but I couldn't see where I'm going wrong. Any ideas? Thanks in advance, Richard