From: James Edward Gray II Date: 2005-04-30T03:05:18+09:00 Subject: Re: Creating arbitrary objects On Apr 29, 2005, at 12:38 PM, Matthew Thill wrote: > I've probably overlooked something, and hopefully someone can help me > out. I want to be able to create arbitrary object from the contents of > a string. > > For example, if I had the following string: > > classname = "Array" > > How can I create an Array object, knowing only that the variable > classname held the name of some class as a string. You're looking for Object.const_get(): irb(main):003:0> class_obj = Object.const_get("Array") => Array irb(main):004:0> arr = class_obj.new => [] Hope that helps. James Edward Gray II