ERB template tags : Embedded Ruby « Development « Ruby






ERB template tags

Tag                Description
<% ... %>          Ruby code; inline with output.
<%= ... %>         Ruby expression; replace with result.
<%# ... %>         Comment; ignored; useful in testing.
%                  A line of Ruby code; treated as <% .. %>; set with trim_mode argument in ERB.new.
%%                 Replace with % if it is the first thing on a line and % processing is used.
<%% ... %%>        Replace with <% or %> , respectively.

 








Related examples in the same category

1.Embedded Ruby
2.Embedded in the string are a pair of template tags, <%= and %>.
3.ERB tags in a string
4.Nested ERB block