ERB(1)
π ERB(1) π
erb β Ruby Templating β¨
Manual section: Ruby Programmer's Reference Guide π
π§Ύ SYNOPSIS π§Ύ
erb [--version] [-UPdnvx] [-E ext[:int]] [-S level] [-T mode]
[-r library] [--] [file ...]
π DESCRIPTION π
okay so erb is a command line front-end for the ERB library, which is an implementation of eRuby π«Ά
ERB gives you an easy-to-use but seriously powerful templating system for Ruby. You can drop actual Ruby code into any plain text document to generate document details and/or handle flow control. it's giving customizable docs, bestie π¦
erb is a part of Ruby π
β¨ OPTIONS β¨
--versionβ shows you which version of erb you're running π§-E external[:internal],--encoding external[:internal]β sets the default external encoding and internal encoding. separate the two with a colon (:) π
you can leave out the internal one, and then the value (Encoding.default_internal) will be nil π
-Pβ turns off ruby code evaluation for lines that begin with%π«-S levelβ sets the safe level that your eRuby script runs in π-T modeβ sets the trim mode, which defaults to0π mode can be one of these:0β the EOL stays put after the embedded ruby script gets evaluated.1β the EOL gets removed if the line ends with%>.2β the EOL gets removed if the line starts with<%and ends with%>.-β the EOL gets removed if the line ends with-%>. also, leading whitespace gets removed if the erb directive starts with<%-. π
-r libraryβ loads a library π-Uβ sets the default internal encoding (Encoding.default_internal) to UTF-8 π«§-d,--debugβ turns on debug mode.$DEBUGgets set totrueπ-h,--helpβ prints a summary of the options π-nβ goes with-x. prepends the line number to each line of the output π’-vβ enables verbose mode.$VERBOSEgets set totrueπ’-xβ converts the eRuby script into a Ruby script and prints it without line numbers πͺ
πΈ EXAMPLES πΈ
here's an eRuby script, periodt:
<?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>
the command is:
% erb -T - example.erb
and it prints:
<?xml version="1.0" ?>
<erb-example>
<calc>2</calc>
<var>example.erb</var>
<library>2, 3, 5, 7</library>
</erb-example>
π SEE ALSO π
and check out the ri(1) docs for the ERB class too π€
π REPORTING BUGS π
- Security vulnerabilities go by email to
security@ruby-lang.org. don't post them anywhere else π ββοΈ reported problems get published after they're fixed π - Other bugs and feature requests can go to the Ruby Issue Tracking System (
https://bugs.ruby-lang.org/). do not report security vulnerabilities through this system, because it publishes them immediately π
π AUTHORS π
written by Masatoshi SEKI π
ok bestie, that's the whole tea β this page came from UNIX, dated December 16, 2018, and it's ERB(1) ππ ily, now go template something iconic π¦β¨
π¦ where this page comes from
- ubuntu noble: ruby3.2 3.2.3-1build3 Β· BSD-2-Clause OR Ruby
- ubuntu noble: ruby3.2 3.2.3-1ubuntu0.24.04.8 Β· BSD-2-Clause OR Ruby
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms