Getting a class from a string containing its name

I have this code:

case classname
when 'Faculty’
f = Faculty.new
when 'Student’
f = Student.new

etc.

How can I automatically get the class from the string that contains
its name? I’m looking for something like Object#method, except that it
gives me a class instead of a method.

Philip Mak pmak@animeglobe.com writes:

I have this code:

case classname
when 'Faculty’
f = Faculty.new
when 'Student’
f = Student.new

etc.

How can I automatically get the class from the string that contains
its name? I’m looking for something like Object#method, except that it
gives me a class instead of a method.

http://www.rubygarden.org/ruby?FindClassesByName

Cheers

Dave