From: Christoph Date: 2005-02-20T08:25:22+09:00 Subject: Re: Dynamically loading and executing within a new module? Lloyd Zusman schrieb: >Actually, I now realize that I don't need a bona fide named module, but >rather, just a way to associate a name with a module. Therefore, I >think that I can do it more or less like this: > > modhash = Hash.new > if fname then > if modhash.has_key?(fname) then > mod = modhash[fname] > else > mod = Module.new > modhash[fname] = mod > end > data = File.new(fname, 'r') do |f| > f.read > end > mod.module_eval data > mod.send :init, args > end > >Does this make sense? > > > > You can also use MyNameSpace#const_get with a rescue clause /Christoph