*** Welcome to piglix ***

ERuby

eRuby (Embedded Ruby)
Stable release
1.0.5 / December 14, 2004 (2004-12-14)
Development status Active
Written in Ruby
Operating system Cross-platform
Type Template engine
License GPL and LGPL

eRuby (Embedded Ruby) is a templating system that embeds Ruby into a text document. It is often used to embed Ruby code in an HTML document, similar to ASP, JSP and PHP. The templating system of eRuby combines the ruby code and the plain text to provide flow control and variable substitution, thus making it easy to maintain.

The View module of the rails is responsible to display the response or output on a browser. In its simplest form, a view can be a piece of HTML code which has some static content. For most applications, just having static content may not be enough. Many Rails applications will require dynamic content created by the controller (action method) to be displayed in their view. This is made possible by using Embedded Ruby to generate templates which can contain dynamic content. Embedded Ruby allows ruby code to be embedded in a view document. This code gets replaced with proper value resulted from the execution of the code at run time. But, by having the ability to embed code in a view document, we risk bridging the clear separation present in the MVC frame. It is thus the responsibility of the developer to make sure that there is a clear separation of responsibility among the model, view and controller modules of his/her application.

eRuby allows Ruby code to be embedded within a pair of <% and %> delimiters. These embedded code blocks are then evaluated in-place (they are replaced by the result of their evaluation). Apart from creating web pages, eRuby can also be used to create XML Documents, RSS feeds and other forms of structured text files. eRuby dynamically generates static files based on templates. These functionalities of eRuby can be found in the ERB Library.


...
Wikipedia

...