From: "David E." Date: 2010-12-04T04:59:49+09:00 Subject: Re: cast object to object Robert Klemme wrote in post #965992: > On 12/03/2010 04:44 PM, Phillip Gawlowski wrote: >>> 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 Robert, thanks. That is the concept. However, I am getting a weird error EXCEPTION:wrong constant name FireWatir::Link after inputting class_name = 'FireWatir::Link' dave = Object.const_get(class_name).new Is my "class_name" formatted correctly? -- Posted via http://www.ruby-forum.com/.