From: wys@... (Clemens Wyss) Date: 2001-02-28T14:40:03+09:00 Subject: [ruby-talk:11746] Re: Subclasses of a Class? Ron Jeffries wrote in <862EB43BAC8F81B2.E29B45DDEBCBB08A.89F9D917D8AAE9B3@lp.airnews.net>: >I'm wanting to set up RubyUnit to automatically run all the suites of >all the subclasses of RUNIT::TestCase, but there doesn't seem to be a >way to get all subclasses of a class ... or I can't find it. > >Is there? What is it? Or is there another way to get all the suites? > >Thanks, > >Ron > >Ronald E Jeffries >http://www.XProgramming.com >http://www.objectmentor.com > Ron, how about this: " $subclassesOfTestCase = [] ObjectSpace.each_object(Class) { | cl | #print cl.name + " has superclass: " + cl.superclass().to_s + "\n" if (cl.superclass() == RUNIT::TestCase) then $subclassesOfTestCase.push(cl) end } print $subclassesOfTestCase " Clemens