From: Lee Jarvis Date: 2010-07-02T23:50:04+09:00 Subject: Re: Requiring files in a module context --0015174c153296d93e048a68b330 Content-Type: text/plain; charset=ISO-8859-1 On 2 July 2010 09:21, Daniel Vartanov wrote: > Hi! I want to replace "default definee" when I require ruby file. > > A short example: http://gist.github.com/461094 > > Of course, it says that One::Configuration is an uninitialized constant. > > So, here is my question: how to require configN.rb so that all > definitions are done inside the module? > > Thanks in advance, > Daniel. > -- > Posted via http://www.ruby-forum.com/. > > You can't do this with require. You probably want module_eval module One module_eval File.read("config1.rb") end module Two module_eval File.read("config2.rb") end def process(config) puts config.value end process One::Configuration process Two::Configuration --0015174c153296d93e048a68b330--