From: Tim Hunter Date: 2004-11-05T07:18:43+09:00 Subject: How to enumerate nested classes I have a class nested in a module: module Foo class Bar ... buncha stuff here end end Within Foo::Bar there are many nested classes, not necessarily descended from Bar, simply contained within its namespace. I would like to write a test that ensures that each class contained within Foo::Bar has a method named deep_copy() somewhere in its inheritence hierarchy. I'd like to write the test without explicitly listing all the nested classes. That is, if I add another class to Foo::Bar, then the test automatically checks it as well. I thought I could do this via ObjectSpace.each_object(Foo::Bar) but that doesn't work. I also tried getting a list of Foo::Bar's constants and going from there but I got nowhere. Any ideas?