From: Michael Linfield Date: 2007-11-09T01:22:08+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 ? > > thanks! > > regs, > buddhika Probably not the best way of doing it but... file = File.readlines("rubyscript.rb") res = [] file.each do |x| res << x end # then using regular expressions you could filter out the upper case words # to be more accurate you could develop a gsub or iteration that includes the # word 'class' i forget the reg. exp. for it but i believe its along the lines of /[A-Z]/ or close to that - Mac -- Posted via http://www.ruby-forum.com/.