From: Daniel Schierbeck Date: 2006-05-10T21:13:41+09:00 Subject: Re: Intantiating a class by name Erich L. Timkar wrote: > For the life of me I haven't been able to find the syntax to > "instatiate" a class given it's name. I know it's silly. I feel silly > and when I hear the answer, I'll fill twice as silly. Anyone wanna take > a stab at this and put me out of my misery? As the other guys have said, RubyGarden have the following implementation: def get_class(name) name.split(/::/).inject{|parent, child| parent.const_get(child) } end I actually have two questions regarding this implementation: 1) Is `/::/' faster than `"::"'? 2) Isn't it more appropriate to call #to_str on `name'? I.e. name.to_str.split(... Cheers, Daniel