From: nobu.nokada@... Date: 2002-12-21T18:06:35+09:00 Subject: Re: String#to_class? Hi, At Sat, 21 Dec 2002 18:00:31 +0900, Tim Bates wrote: > I have a class being used in a unit test: > > TC_Foo > > I match it against a regexp: > > /TC_(.*)/.match(self.class.name) > > I end up with a string ($1 == "Foo") which I want to be an instance of Class > (== Foo). How can I convert a String to a Class? Will I have to use > ObjectSpace to find a Class whose Class#name == "Foo"? eval($1) or Object.const_get($1) -- Nobu Nakada