From: James Edward Gray II Date: 2005-12-12T00:52:18+09:00 Subject: Re: erb and scope On Dec 11, 2005, at 6:36 AM, Wybo Dekker wrote: > On Sun, 11 Dec 2005, Stefan Lang wrote: > >>> puts ERB.new(FOO).result >> >> replace above line with: >> >> puts ERB.new(FOO).result(binding) > > That helps (although I don't understand it yet, but I'll find out), > thanks! ERb templates are resolved in the scope of some "binding". They have access to the variables in that binding. There is a private method on Object (universally available) called binding(), which just returns a Binding object for the current scope. By handing that to ERb, you can control what it can access. Hope that helps. James Edward Gray II