Eruby
From Wikipedia, the free encyclopedia
- For type of implementation of embedded Ruby into HTML, see eRuby.
- The correct title of this article is eruby. The initial letter is shown capitalized due to technical restrictions.
eruby is an implementation of eRuby, embedding Ruby programming language into HTML document. An eRuby file ends with .rhtml file extension.
[edit] Scripting element
Ruby codes are embedded with in a pair of <%
and %>
delimiters.
There are only three type of script element in eruby:
<% ruby code %>
- Output like hello fromprint "hello"
would replace the ruby code between the delimiters.<%= ruby expression %>
- Value evaluated from expression like 11 from7 + 4
would replace the ruby expression between the delimiters.<%# ruby code %>
- ruby code is ignored and generates nothing.
[edit] See also
[edit] External links
- "Ruby and the web", a chapter from "The Pragmatic Programmer's Guide"