Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon



ERB is a template created in 2004.

#316on PLDB 18Years Old 400Users
0Books 0Papers 276Repos

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. Read more on Wikipedia...

Example from the web:
<ul> <% 4.times do %> <li>list item</li> <% end %> </ul>
Example from Linguist:
<% provide(:title, @header) %> <% present @users do |user_presenter| %> <div class="row key-header"> <h1><%= @header %></h1> </div> <div class='row'> <div class='small-12 columns'> <%= will_paginate %> </div> </div> <div class="row key-table"> <div class="small-12 columns"> <div class="row key-table-row"> <div class="small-2 columns">Name</div> <div class="small-3 columns">Email</div> <div class="small-1 columns">Chords</div> <div class="small-1 columns">Keys</div> <div class="small-1 columns">Tunings</div> <div class="small-1 columns">Credits</div> <div class="small-1 columns">Prem?</div> <div class="small-2 columns">Since?</div> </div> <% if @users == [] %> <div class="row key-table-row"> <div class="small-4 small-centered columns">No Users</div> </div> <% else %> <%= render @users %> <% end %> </div> </div> <div class='row'> <div class='small-12 columns'> <%= will_paginate %> </div> </div> <% end %>
Example from Wikipedia:
class ERBExample attr_accessor:variable1 # using bind to access class variables def render() renderer.result(binding) end def initialize(variable1) @variable1 = variable1 end # Expose private binding() method. def get_binding binding() end end example = renderer = puts output = renderer.result(example.get_binding)
g-code.html 路 erb.html 路 clipper.html

View source

PLDB - Build the next great programming language 路 v2022 Day 32 Docs Build Acknowledgements Traffic Today Traffic Trends Mirrors GitHub