From: Lloyd Zusman Date: 2005-02-20T11:44:03+09:00 Subject: Re: Dynamically loading and executing within a new module? Christoph writes: > Lloyd Zusman schrieb: > >>However, the "eval fname.capitalize" part doesn't create a new module, >>and that's part of what is confusing me about all this. Given a string >>"Foo", what do I do to it in order to create a module object with that >>name? >> >> > use Module#new - for example > > --- > MyNameSpace.const_set fname.capitalize, Module.new > --- > > You can automate things > > class MyModule < Module > def initialize(fname) > ::MyNameSpace.const_set fname.capitalize, self > # maybe add the the MyModule method > # using the text file .... > end > end > /Christoph Aha! ... that's a great idea. I love how ruby (like Smalltalk) makes classes, objects, etc. into first-class objects. -- Lloyd Zusman ljz@asfast.com God bless you.