From: 7stud -- Date: 2009-05-11T08:38:28+09:00 Subject: Re: Adding data to text file variables Stuart Clarke wrote: > Thanks for your prompt reply. Can I run over a few bits of the code you > send across? > Here's a simpler example to start with: require 'erb' file_contents =<. I see that you are wearing a new <%= clothing %>. That looks good on you. What a <%= adj %> day it is today. Goodbye. ENDOFSTRING template = ERB.new(file_contents) name, clothing, adj = "Diane", "dress", "lovely" new_contents = template.result puts new_contents --output:-- Hello there Diane. I see that you are wearing a new dress. That looks good on you. What a lovely day it is today. Goodbye. The result method looks for the variables name, clothing, and adj in the current scope. -- Posted via http://www.ruby-forum.com/.