ERB(1) Ruby Programmers Reference Guide ERB(1)NAME
erb -- Ruby Templating
erb [--version] [-UPdnvx] [-E ext[:int]] [-S level] [-T mode] [-r library] [--] [file ...]
erb is a command line front-end for ERB library, which is an implementation of eRuby.
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.
erb is a part of Ruby.
OPTIONS --version Prints the version of erb.
Specifies the default value(s) for external encodings and internal encoding. Values should be separated with colon (:).
You can omit the one for internal encodings, then the value (Encoding.default_internal) will be nil.
-P Evaluates lines starting with % as Ruby code and removes the tailing EOLs.
-S level Specifies the safe level in which eRuby script will run.
-T mode Specifies trim mode (default 0). mode can be one of
0 EOL remains after the embedded ruby script is evaluated.
1 EOL is removed if the line ends with %>.
2 EOL is removed if the line starts with <% and ends with %>.
- EOL is removed if the line ends with -%>. And leading whitespaces are removed if the erb directive starts with
-U can be one of Sets the default value for internal encodings (Encoding.default_internal) to UTF-8.
--debug Turns on debug mode. $DEBUG will be set to true.
--help Prints a summary of the options.
-n Used with -x. Prepends the line number to each line in the output.
-v Enables verbose mode. $VERBOSE will be set to true.
-x Converts the eRuby script into Ruby script and prints it without line numbers.
Here is an eRuby script
<?xml version="1.0" ?>
<% require 'prime' -%>
<calc><%= 1+1 %></calc>
<var><%= __FILE__ %></var>
<library><%= Prime.each(10).to_a.join(", ") %></library>
% erb -T - example.erb
<?xml version="1.0" ?>
<library>2, 3, 5, 7</library>
SEE ALSO ruby(1).
And see ri(1) documentation for ERB class.
Security vulnerabilities should be reported via an email to <email@example.com>. Reported problems will be published after being fixed.
And you can report other bugs and feature requests via the Ruby Issue Tracking System (http://bugs.ruby-lang.org). Do not report security
vulnerabilities via the system because it publishes the vulnerabilities immediately.
Written by Masatoshi SEKI.
UNIX November 7, 2012 UNIX
Check Out this Related Man Page
ruby-switch - switch between different Ruby interpreters
ruby-switch --set RUBYVERSION
ruby-switch can be used to easily switch to different Ruby interpreters as the default system-wide interpreter for your Debian system.
When run with --list, all supported Ruby interpreters are listed.
When --check is passed, ruby-switch will check which Ruby interpreter is currently being used. If the settings are inconsistent -- e.g.
`ruby` is Ruby 1.8 and `gem` is using Ruby 1.9.1, ruby-switch will issue a big warning.
When --set RUBYINTERPRETER is used ruby-switch will switch your system to the corresponding Ruby interpreter. This includes, for example,
the default implementations for the following programs: ruby, gem, irb, erb, testrb, rdoc, ri.
ruby-switch --set auto will make your system use the default Ruby interpreter currently suggested by Debian.
OPTIONS -h, --help
Displays the help and exits.
A NOTE ON RUBY 1.9.x
Ruby uses two parallel versioning schemes: the `Ruby library compatibility version' (1.9.1 at the time of writing this), which is similar
to a library SONAME, and the `Ruby version' (1.9.3 is about to be released at the time of writing).
Ruby packages in Debian are named using the Ruby library compatibility version, which is sometimes confusing for users who do not follow
Ruby development closely.
ruby-switch also uses the Ruby library compatibility version, so specifying `ruby1.9.1' might give you Ruby with version 1.9.2, or with
version 1.9.3, depending on the current Ruby version of the `ruby1.9.1' package.
COPYRIGHT AND AUTHORS
Copyright (c) 2011, Antonio Terceiro <firstname.lastname@example.org>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.