From: Benoit Cerrina Date: 2001-05-21T15:40:10+09:00 Subject: [ruby-talk:15458] Re: Newbye question: retrieving a Class by its classname of course I meant return eval("#{name}"), this is just a typo, my question is still valid Benoit "Benoit Cerrina" wrote in message news:9e9c2a$1r8$1@wanadoo.fr... > Hi, > I've been retrieving a Class object by its class name by doing: > > def XmlElem.getClass4Name(name) > if(eval("defined? #{name} and #{name}.type == Class ")) > return eval("#name") > else > return nil > end > end > > it seems to work but is it the best way, I try to avoid using eval normally. > Benoit > >