From: Thomas Counsell Date: 2004-10-13T22:27:07+09:00 Subject: Re: eRuby for Windows Here is a template: <% if welcoming %>

Hello <%= name %>

<% else %>

Goodbye <%= name %>

<% end %> And some code: require 'erb' erb = ERB.new( IO.readlines( "template_file_name").join ) welcome = true name = "Ruby" html = erb.result( binding ) Hope that gives you an idea. Tom On 13 Oct 2004, at 14:21, Gavin Kistner wrote: > On Oct 13, 2004, at 3:22 AM, David Heinemeier Hansson wrote: >> Yes, it's called ERb and is basically a Ruby-version of eRuby. It's >> even included in the standard library with Ruby 1.8.x. Have a look at >> http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/index.html > > Awesome. Thanks, David! > > Except...erm...there's no documentation. > > When I have more free time I'd love to help out the ruby-doc project > and document this library. But right now I'm working 12 hour days and > don't have time to dive into the source code to figure it out. > > Anyone have a bit of an example showing how to set up an HTML template > with embedded ruby code, and then load that template into the program > code at a current state (so all the necessary variables are setup) and > 'flatten' the template into the output HTML? > >