From nathan at nathanpowell.org Tue May 1 21:10:19 2007 From: nathan at nathanpowell.org (n_powell) Date: Tue, 1 May 2007 21:10:19 -0400 Subject: [Harrisburg-ruby-talk] IRC Message-ID: <20070502011019.GF22285@nathanpowell.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This may be completely useless, but Lon and I created a #ruby channel on the local LUG server irc.cplug.net #ruby The server supports ssl as well, if that is your bag. We will likely be ideling in there all the time, so if you join and say something and no one responds...we are likely AFK Other channels that may be of interest are #cplug (the linux user group chanel) and #hpm (The Harrisburg Perl Mongers Channel) as well as #python Which is filled with losers :) (j/k) - -- nathan nathan_at_nathanpowell_dot_org Telling someone who procrastinates to buy a weekly planner is like telling someone with chronic depression to just cheer up - ------------------------------------ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGN+T7v3H2lx1re5YRAirIAKCI6RQBbXc0d3tbU3XMru61khjCzgCeMOus Y5wlGIYMyYx1j0wUieHNpLE= =IwYX -----END PGP SIGNATURE----- From nathan at nathanpowell.org Sat May 5 23:13:31 2007 From: nathan at nathanpowell.org (n_powell) Date: Sat, 5 May 2007 23:13:31 -0400 Subject: [Harrisburg-ruby-talk] String as class name Message-ID: <20070506031331.GS17989@nathanpowell.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello. Not sure how many people are sub'd to this list, but I figured this is as good a place as any to ask a question. I am working a project, and in the code I want to slurp a dir of files. The files each contain ruby classes, named similar to the file name. For example, foo.rb, contains the class Foo. With some regexing I have taken the file name, and from that extrapolated the class name. Example: klass = file.capitalize.gsub(/.rb$/, '') Now I want to create an instance of the Foo class. I am unsure how to do that since klass is a String object. Any ideas? Or do I need to provide more info? - -- nathan nathan_at_nathanpowell_dot_org The longer I live the more I see that I am never wrong about anything, and that all the pains I have so humbly taken to verify my notions have only wasted my time. ~ George Bernard Shaw - ------------------------------------ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGPUfbv3H2lx1re5YRAhC2AJ9EETh7Cou7k7x0WvVNiO6pJPADGQCfV5aj /vfV5YQ/3OZAIa4G+8wrSGg= =MlOO -----END PGP SIGNATURE----- From nathan at nathanpowell.org Sat May 5 23:49:00 2007 From: nathan at nathanpowell.org (n_powell) Date: Sat, 5 May 2007 23:49:00 -0400 Subject: [Harrisburg-ruby-talk] String as class name In-Reply-To: <20070506031331.GS17989@nathanpowell.org> References: <20070506031331.GS17989@nathanpowell.org> Message-ID: <20070506034900.GT17989@nathanpowell.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Got it. inst = Kernel.const_get(klass).new inst is a new instance of the class from the string. Had to get the googling just right: http://infovore.org/tag/ruby/page/2/ On Sat, May 05, 2007 at 11:13:31PM -0400 thus spake n_powell: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hello. > > Not sure how many people are sub'd to this list, but I figured this > is as good a place as any to ask a question. > > I am working a project, and in the code I want to slurp a dir of files. > > The files each contain ruby classes, named similar to the file name. > For example, foo.rb, contains the class Foo. With some regexing I > have taken the file name, and from that extrapolated the class name. > > Example: > > klass = file.capitalize.gsub(/.rb$/, '') > > Now I want to create an instance of the Foo class. I am unsure how > to do that since klass is a String object. > > Any ideas? Or do I need to provide more info? > - -- > nathan > nathan_at_nathanpowell_dot_org > > The longer I live the more I see that I am never wrong about anything, > and that all the pains I have so humbly taken to verify my notions have only wasted my time. > ~ George Bernard Shaw > - ------------------------------------ > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.6 (GNU/Linux) > > iD8DBQFGPUfbv3H2lx1re5YRAhC2AJ9EETh7Cou7k7x0WvVNiO6pJPADGQCfV5aj > /vfV5YQ/3OZAIa4G+8wrSGg= > =MlOO > -----END PGP SIGNATURE----- > _______________________________________________ > Harrisburg-ruby-talk mailing list > Harrisburg-ruby-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/harrisburg-ruby-talk - -- nathan nathan_at_nathanpowell_dot_org If you optimize everything, you will always be unhappy. ~ Donald Knuth - ------------------------------------ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGPVAsv3H2lx1re5YRAm6CAJ4g5r76GvnbNXwXeuDm08ctHhl8XwCfZX5R qHBwJ02k6S8MMrSGU0lBOHU= =J9bo -----END PGP SIGNATURE-----