From: Massimiliano Mirra Date: 2002-03-22T23:11:43+09:00 Subject: Re: erb: how to include(import,load) another erb file? On Fri, Mar 22, 2002 at 12:27:33PM +0900, m_seki@mva.biglobe.ne.jp wrote: > > > > In real applications (such as CGI), I always write the method which > > > build sub part in Ruby script. > > > > Can one pass variables to imported files this way? > > How about using instance variablies? Stoopid me. Yes, of course. I had tried that without success and I had concluded that they were evaluated in two different contexts, while instead I had just omitted the .result(binding) in the import method. About the `strange' thing I pointed out, it happened because the imported ERbLight overwrote the already compiled source. By passing a binding from the main source to the imported one, _erbout got evaluated in the context of the main source. By changing _erbout so another name all went well. I'm really happy with ERb so far. I'm finding I can reproduce almost all functionalities I used with the Template Toolkit and I'm sure there's a whole new lot waiting. Thanks for bringing this to us! Massimiliano