of course I meant return eval("#{name}"), this is just a typo, my question
is still valid
Benoit
"Benoit Cerrina" <benoit.cerrina / writeme.com> 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
>
>