Robert Dober wrote: > On 4/9/06, Brian Parkinson <parkI / whatevernot.com> wrote: >> >> parki... > > > I am afraid that the only one-liner is eval :( > > suppose s contains the name of your class > Module.const_get s does not work unless your class is defined on top > level. > In oder to have the *same* semantics as > > eval(s).new > > we have to write > > m = Module > s.split(%r{::|\.}).each do > |name| > m = m.const_get(name) > end > m.new s.split('::').inject(Object) { |s,k| s.const_get(k) }.new -- Jim Weirich -- Posted via http://www.ruby-forum.com/.