On Thursday, October 16, 2003, 9:00:04 AM, Florian wrote:

> Simon Kitching wrote:

>> Hi,

> Moin!

>> I have a string containing the name of a class, and want to get the
>> corresponding Class object. My current approach is:
>>   Module.class_eval(classname)
>> Is this the best approach?

> It isn't -- an user might inject arbitary code. Use this instead:

irb(main):001:0>> Object.const_get('Class')
=>> Class

That won't work for class names like "Test::Unit::TestCase".  This is
discussed on the Wiki.  Search "class" and you'll find it I'm sure.

> [...]

Gavin