From: Aaron Smith Date: 2007-07-21T10:52:32+09:00 Subject: Re: ERB question, not seeing variables.. Jesse Brown wrote: >> e = ERB.new(template_content, 0, "%<>") >> e.result > > I'm not sure if it will be helpful in your situation, but e.result > will accept a binding parameter. That binding is used to resolve local > variables in the template. yeah I got if figured out.. thanks.. require 'erb' class TemplateParser def TemplateParser.parse(template, params) params.each do |k,v| self.instance_variable_set(:"@#{k}",v) end template_content = '' File.open(template, "r") do |f| while line = f.gets template_content << line end end e = ERB.new(template_content, 0, "%<>") e.result(self.send("binding")) end end -- Posted via http://www.ruby-forum.com/.