From: Tim Hunter Date: 2009-05-26T02:22:30+09:00 Subject: Re: dynamic object creation Ken Tyler wrote: > sorry if i've missed something obvious > > is there a way in ruby to dynamically create an object from a variable > that holds the object's name? > > something that does object.create("some_object_name") Assuming you mean "a variable that holds the class's name", check out Module.const_get. This method takes a string and returns the value of the constant having that name. Since the value of the constant Array is the Array class object, we can get the Array class object like this: cls = Module.const_get("Array") And then call new on the class object to create a new array: ary = cls.new -- RMagick: http://rmagick.rubyforge.org/