On Fri, Dec 3, 2010 at 11:35 AM, Robert Klemme
<shortcutter / googlemail.com> wrote:
>
>> name_of_my_class.to_class =A0# Create a class out of the user input
>
> That sounds more like it.
>
> David, you could do
>
> class_name =3D ... # fetch the name from somewhere
> dave =3D Object.const_get(class_name).new

Or for a more robust solution which can also handle strings like
"Module::Class" have a look at the String#constantize method from
activesupport (part of Rails)


--=20
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Github: http://github.com/rubyredrick
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale