G
Glenn
[Note: parts of this message were removed to make it a legal post.]
Hi,
I am trying to write the output of an erb run to an external output file. I have an object with some instance variables in it, and a string of html and the instance variables (in the erb style with <% and <%=).
I require erb and create a local variable that's a erb object, then call run on that object, like this:
require "erb"
template = %q{
some html in here
}.gsub(/^ /, '')
f = File.new('myfile.rhtml', 'w')
rhtml = ERB.new(template)
rhtml.run(o.get_binding)
I just can't figure out how to direct the result into the f file object. Any suggestions?
I read a lot of the documentation but did not see (or understand) a reference to this.
Thanks!
Hi,
I am trying to write the output of an erb run to an external output file. I have an object with some instance variables in it, and a string of html and the instance variables (in the erb style with <% and <%=).
I require erb and create a local variable that's a erb object, then call run on that object, like this:
require "erb"
template = %q{
some html in here
}.gsub(/^ /, '')
f = File.new('myfile.rhtml', 'w')
rhtml = ERB.new(template)
rhtml.run(o.get_binding)
I just can't figure out how to direct the result into the f file object. Any suggestions?
I read a lot of the documentation but did not see (or understand) a reference to this.
Thanks!