erb

ERB

ri

 ------------------------------------------------------------- Class: ERB
 
 ERB -- RUBY TEMPLATING
 ======================
 
 Introduction
 ------------
      ERB provides an easy to use but powerful templating system for
      Ruby. Using ERB, actual Ruby code can be added to any plain text
      document for the purposes of generating document information
      details and/or flow control.
 
      A very simple example is this:
 
        require 'erb'
      
        x = 42
        template = ERB.new <<-EOF
          The value of x is: <%= x %>
        EOF
        puts template.result(binding)
 
      _Prints:_ The value of x is: 42
 
      More complex examples are given below.
 
 
 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
 
      All other text is passed through ERB filtering unchanged.
 
 
 Options
 -------
      There are several settings you can change when you use ERB:
 
      *   the nature of the tags that are recognized
		
  • 2006/05/15 14:13:26 def
  • 2006/05/12 19:59:03 ERB
  • 2006/05/15 12:42:14 new
  • 2006/05/15 11:59:52 ^