From: Rich Kilmer Date: 2002-04-28T08:18:07+09:00 Subject: RE: string to class? You can always do: str = "Array" aclass = eval(str) a = aclass.new > -----Original Message----- > From: Mike Hall [mailto:mghall@enteract.com] > Sent: Saturday, April 27, 2002 6:21 PM > To: ruby-talk ML > Subject: Q: string to class? > > I've got a string, and I'd like to get a class reference. > It's probably easy; I just haven't found the right methods yet. > > Example: > # given 'Array' string, make a new Array > str = "Array" > aclass = something_or_other(str) > a = aclass.new > > I can turn it into a symbol, and back to a string, > and have thought about 'send'ing a 'class' message, > but there's still a big chasm between me > and the desired result! :-) > > Any clues? > Thanks! > -- > Mike Hall