From: Robert Klemme Date: 2010-12-04T01:35:25+09:00 Subject: Re: cast object to object On 12/03/2010 04:44 PM, Phillip Gawlowski wrote: > On Fri, Dec 3, 2010 at 4:39 PM, David E. wrote: >> Yeah maybe the string confused things. I don't want to even convert to >> string. >> >> The value in string is the "human name" of the class i want to convert >> it to. >> >> So i'm converting a string into an object of class type of the string >> value. >> >> So convert "Dave" into an object of type Dave() > > So, you want to do something like: > name_of_my_class.gets I don't think so. > name_of_my_class.to_class # Create a class out of the user input That sounds more like it. David, you could do class_name = ... # fetch the name from somewhere dave = Object.const_get(class_name).new Kind regards robert