INTRODUCTION
ERB provides an easy to use but powerful templating system for Ruby.
Rails/RoR, the web application framework, uses ERB to create views.
EDITORIAL NOTE:
Shamelessly compiled and copied from:
http://ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html
RECOGNIZED TAGS
ERB recognizes certain tags in the provided template and converts
them based on the rules below:
<% Ruby code -- inline with output %>
<%= Ruby expression -- replace with result %>
<%# comment -- ignored -- useful in testing %>
% a line of Ruby code -- treated as <% line %> (optional -- see ERB.new)
%% replaced with % if first thing on a line and % processing is used
<%% or %%> -- replace with <% or %> respectively
<%- and -%> suppress leading and trailing whitespace, including the trailing newline, and can be used interchangeably with <% and %>.
All other text is passed through ERB filtering unchanged.
ALTERNATIVES
There are a variety of templating solutions available in various Ruby projects:
* ERB‘s big brother, eRuby, works the same but is written in C for speed;
* Erubis is a fast, secure, and very extensible implementation of eRuby
* Amrita (smart at producing HTML/XML);
* cs/Template (written in C for speed);
* RDoc uses its own template engine, which can be reused elsewhere;
* and others; search the RAA.