From: Codeblogger Date: 2007-02-15T05:45:22+09:00 Subject: Re: how to do: var1 = var2.new(.....) (var2 contains classname) ------=_Part_23010_4943429.1171485910108 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Maybe you want to have a look at this: var1 = Object.const_get(var2) Kind regards Nicolai 2007/2/14, Luca Scaljery : > > Hi All > > I have a situation in which I have the name of the class in a variable > So normally I would do > song = Song.new("Bicylops", "Fleck", 260) > > But I need to do something like > var2 = "Song" > var1 = var2.new("Bicylops", "Fleck", 260) > > This doesn't work! > Any suggestions how to do this ? > > Thnx > LuCa > > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_23010_4943429.1171485910108--