From: Jeff Barczewski Date: 2006-07-28T02:59:15+09:00 Subject: Re: The Ruby/ERB way to do this? ------=_Part_13095_3352417.1154023152912 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Well a couple of ideas there. If you include the Module (X) then you don't have to use the X:: prefix when referencing the constants they become part of the local namespace and this is true in the erb template which is executing using the binding. So if you have a file myconstants.rb module MyConstants Foo = 'bar' end And your program does this require 'erb' require 'myconstants' include MyConstants erb = ERB.new 'my template here <%= Foo %>' b = binding puts erb.result(b) # gives you 'my template here bar Jeff On 7/27/06, Peter Booth wrote: > > Thanks for taking the time to reply. Using a variable of require is a good > idea. > > Referencing variables as X::Size seems verbose. Is there any way for > require > to define a set of local scoped variables so the ERB template could drop > the > X:: prefix? > > ------=_Part_13095_3352417.1154023152912--