ERB(1) | 1 (ruby programmer's reference guide) | ERB(1) |
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
.
--version
erb
.
-E
external[:internal]--encoding
external[:internal]You can omit the one for internal encodings, then the value
(Encoding.default_internal
)
will be nil.
-P
%
as Ruby code and
removes the tailing EOLs.
-S
level-T
mode-r
-U
Encoding.default_internal
) to
UTF-8.
-d
--debug
$DEBUG
will be set to true.
-h
--help
-n
-x
. Prepends the line number to each
line in the output.
-v
$VERBOSE
will be set to
true.
-x
Here is an eRuby script
<?xml version="1.0" ?> <% require 'prime' -%> <erb-example> <calc><%= 1+1 %></calc> <var><%= __FILE__ %></var> <library><%= Prime.each(10).to_a.join(", ") %></library> </erb-example>
Command
% erb -T - example.erb
<?xml version="1.0" ?> <erb-example> <calc>2</calc> <var>example.erb</var> <library>2, 3, 5, 7</library> </erb-example>
And see ri(1) documentation for
ERB
class.
Written by Masatoshi SEKI.
November 15, 2012 | UNIX |