From: Robert Klemme Date: 2003-07-02T20:37:21+09:00 Subject: Re: dynamic object creation "Brian Candler" schrieb im Newsbeitrag news:20030630171414.A19372@linnet.org... > On Tue, Jul 01, 2003 at 01:01:25AM +0900, Aryeh Friedman wrote: > > If I have something like this: > > > > s="Array" > > > > How whould I get something like this: > > > > aObject=s.new > > > > In "plain" english I am asking if I have a valid name of a class in a > > string how do I create an instance of the class the string contains? > > A class name is just a constant, so something like > > a = Module.const_get("Array").new > > is what you need (Aside: what's the proper way to access 'the top-level > Module', or is the above correct?) I think this does it a = Kernel.const_get("Array").new robert