From: 7stud -- Date: 2007-11-09T03:49:12+09:00 Subject: Re: getting the names of classes defined in a ruby script Thilina Buddhika wrote: > I want to get the names of the classes defined in a Ruby script. Is > there any possible way of doing this ? > Try this: class Class Seen_classes = [] def inherited(class_obj) Seen_classes << class_obj.name end def Seen_classes Seen_classes end end class Dog end class Monkey end module Food end PI = 3.14 def meth1 end p Class.Seen_classes --output:-- ["Dog", "Monkey"] -- Posted via http://www.ruby-forum.com/.