Last Modified
2014-07-31 09:02:16 -0700


Cheap-n-cheerful HTML page template system. You create a template containing:

You feed the code a hash. For simple variables, the values are resolved directly from the hash. For blocks, the hash entry corresponding to key will be an array of hashes. The block will be generated once for each entry. Blocks can be nested arbitrarily deeply.

The template may also contain

  ... stuff

stuff will only be included in the output if the corresponding key is set in the value hash.

Usage: Given a set of templates T1, T2, etc

   values = { "name" => "Dave", state => "TX" }

   t =, T2, T3), "w") {|f| t.write_html_on(f, values)}
   res = ''
   t.write_html_on(res, values)

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit

blog comments powered by Disqus