From: Paul Duncan Date: 2003-02-13T07:24:10+09:00 Subject: Re: creating objects using strings --87MiR7gHvrw39A9h Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Dave Thomas (dave@pragmaticprogrammer.com) wrote: > George Mochrie wrote: >=20 > >Is it possible to create an object of a specific type when all I have is= =20 > >the name of the class in a string?=20 >=20 > There's a page on the Wiki on this: >=20 > http://www.rubygarden.org/ruby?FindClassesByName I know we've been through this before, but I thought I'd repeat it anyway. I have a slightly more robust version, called String#to_class, which handles periods, "relative" class paths, and anonymous namespaces. Check it out at http://www.pablotron.org/download/string_to_class.rb. PS I wasn't quite sure where to put this on the Wiki page. Before the simple example? After it? Not at all? Dave? > Cheers >=20 > Dave >=20 --=20 Paul Duncan pabs in #gah (OPN IRC) http://www.pablotron.org/ OpenPGP Key ID: 0x82C29562 --87MiR7gHvrw39A9h Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+SsmFzdlT34LClWIRAoN7AKDIXEcazhkAIx8MJn9qVgzeudMl4ACfYq4M yhqO+8t5wSGvnNR05otPhYc= =b48J -----END PGP SIGNATURE----- --87MiR7gHvrw39A9h--