1ERB(1)                 Ruby Programmer's Reference Guide                ERB(1)
2

NAME

4     erb — Ruby Templating
5

SYNOPSIS

7     erb [--version] [-UPdnvx] [-E ext[:int]] [-S level] [-T mode]
8         [-r library] [--] [file ...]
9

DESCRIPTION

11     erb is a command line front-end for ERB library, which is an implementa‐
12     tion of eRuby.
13
14     ERB provides an easy to use but powerful templating system for Ruby.
15     Using ERB, actual Ruby code can be added to any plain text document for
16     the purposes of generating document information details and/or flow con‐
17     trol.
18
19     erb is a part of Ruby.
20

OPTIONS

22     --version      Prints the version of erb.
23
24     -E external[:internal]
25     --encoding external[:internal]
26                    Specifies the default value(s) for external encodings and
27                    internal encoding. Values should be separated with colon
28                    (:).
29
30                    You can omit the one for internal encodings, then the
31                    value (Encoding.default_internal) will be nil.
32
33     -P             Disables ruby code evaluation for lines beginning with %.
34
35     -S level       Specifies the safe level in which eRuby script will run.
36
37     -T mode        Specifies trim mode (default 0).  mode can be one of
38
39                          0       EOL remains after the embedded ruby script
40                                  is evaluated.
41
42                          1       EOL is removed if the line ends with %>.
43
44                          2       EOL is removed if the line starts with <%
45                                  and ends with %>.
46
47                          -       EOL is removed if the line ends with -%>.
48                                  And leading whitespaces are removed if the
49                                  erb directive starts with <%-.
50
51     -r             Load a library
52
53     -U             can be one of Sets the default value for internal encod‐
54                    ings (Encoding.default_internal) to UTF-8.
55
56     -d
57     --debug        Turns on debug mode.  $DEBUG will be set to true.
58
59     -h
60     --help         Prints a summary of the options.
61
62     -n             Used with -x.  Prepends the line number to each line in
63                    the output.
64
65     -v             Enables verbose mode.  $VERBOSE will be set to true.
66
67     -x             Converts the eRuby script into Ruby script and prints it
68                    without line numbers.
69

EXAMPLES

71     Here is an eRuby script
72
73           <?xml version="1.0" ?>
74           <% require 'prime' -%>
75           <erb-example>
76             <calc><%= 1+1 %></calc>
77             <var><%= __FILE__ %></var>
78             <library><%= Prime.each(10).to_a.join(", ") %></library>
79           </erb-example>
80
81     Command
82           % erb -T - example.erb
83     prints
84
85           <?xml version="1.0" ?>
86           <erb-example>
87             <calc>2</calc>
88             <var>example.erb</var>
89             <library>2, 3, 5, 7</library>
90           </erb-example>
91

SEE ALSO

93     ruby(1).
94
95     And see ri(1) documentation for ERB class.
96

REPORTING BUGS

98     ·   Security vulnerabilities should be reported via an email to
99         security@ruby-lang.org.  Reported problems will be published after
100         being fixed.
101
102     ·   Other bugs and feature requests can be reported via the Ruby Issue
103         Tracking System (https://bugs.ruby-lang.org/).  Do not report secu‐
104         rity vulnerabilities via this system because it publishes the vulner‐
105         abilities immediately.
106

AUTHORS

108     Written by Masatoshi SEKI.
109
110UNIX                           December 16, 2018                          UNIX
Impressum