From: Robert Klemme Date: 2010-08-28T00:40:14+09:00 Subject: Re: Avoiding eval On 27.08.2010 17:24, Andrew Wagner wrote: > If I have a string like "Math", I know I can use const_get to turn it into > an instance of Class. Awesome. > > But what if I have something like "Math::PI". Am I stuck using eval to > resolve that? One typical idiom looks like this: a_class = str.split('::').inject(Object) {|cl,n| cl.const_get n} Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/