> Lähettäjä: "David McCabe" <davemccabe@gmail.com>
> Aihe: Re: Creating objects from a template
>
> Robert's solution seems to do exactly what I want. Hurrah!
>
> The only thing I'm changing is making a hash with the new classes so
> that I can instantiate them easily given their names:
>
> Object.const_set klass_name, klass
> kinds[klass_name.intern] = klass
>
> called_for = :LongRange
> p kinds[called_for].new
>
> If this isn't the Right Thing in ruby, any pointers on better ways to
> do it would be appreciated.
If you have a String, you can eval it :)
s = 'Hash'
h = eval(s).new
> Thank you all!
E