Linux server1.dn-server.com 4.18.0-553.89.1.lve.el8.x86_64 #1 SMP Wed Dec 10 13:58:50 UTC 2025 x86_64
LiteSpeed
Server IP : 195.201.204.189 & Your IP : 216.73.216.37
Domains :
Cant Read [ /etc/named.conf ]
User : beriska1
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
opt /
alt /
ruby19 /
share /
ri /
1.9.1 /
system /
ERB /
Delete
Unzip
Name
Size
Permission
Date
Action
DefMethod
[ DIR ]
drwxr-xr-x
2026-05-01 04:24
Util
[ DIR ]
drwxr-xr-x
2026-05-01 04:24
cdesc-ERB.ri
8.22
KB
-rw-r--r--
2023-07-26 17:26
def_class-i.ri
749
B
-rw-r--r--
2023-07-26 17:26
def_method-i.ri
598
B
-rw-r--r--
2023-07-26 17:26
def_module-i.ri
630
B
-rw-r--r--
2023-07-26 17:26
filename-i.ri
256
B
-rw-r--r--
2023-07-26 17:26
new-c.ri
2.55
KB
-rw-r--r--
2023-07-26 17:26
result-i.ri
523
B
-rw-r--r--
2023-07-26 17:26
run-i.ri
237
B
-rw-r--r--
2023-07-26 17:26
set_eoutvar-i.ri
412
B
-rw-r--r--
2023-07-26 17:26
src-i.ri
190
B
-rw-r--r--
2023-07-26 17:26
version-c.ri
230
B
-rw-r--r--
2023-07-26 17:26
Save
Rename
U:RDoc::NormalClass[iI"ERB:EF@I"Object;Fo:RDoc::Markup::Document:@parts[o;;[=S:RDoc::Markup::Heading: leveli: textI"ERB -- Ruby Templating;To:RDoc::Markup::BlankLine S; ; i;I"Introduction;T@o:RDoc::Markup::Paragraph;[I"PERB provides an easy to use but powerful templating system for Ruby. Using;TI"JERB, actual Ruby code can be added to any plain text document for the;TI"Mpurposes of generating document information details and/or flow control.;T@o; ;[I"#A very simple example is this:;T@o:RDoc::Markup::Verbatim;[I"require 'erb' ;FI" ;FI"x = 42 ;FI"template = ERB.new <<-EOF ;FI"# The value of x is: <%= x %> ;FI" EOF ;FI"#puts template.result(binding) ;Fo; ;[I"+<em>Prints:</em> The value of x is: 42;T@o; ;[I"+More complex examples are given below.;T@S; ; i;I"Recognized Tags;T@o; ;[I"QERB recognizes certain tags in the provided template and converts them based;TI"on the rules below:;T@o;;[I"+<% Ruby code -- inline with output %> ;FI"3<%= Ruby expression -- replace with result %> ;FI"4<%# comment -- ignored -- useful in testing %> ;FI"N% a line of Ruby code -- treated as <% line %> (optional -- see ERB.new) ;FI"J%% replaced with % if first thing on a line and % processing is used ;FI"6<%% or %%> -- replace with <% or %> respectively ;Fo; ;[I">All other text is passed through ERB filtering unchanged.;T@S; ; i;I"Options;T@o; ;[I"@There are several settings you can change when you use ERB:;To:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;[o; ;[I"0the nature of the tags that are recognized;;To;;0;[o; ;[I"Athe value of <tt>$SAFE</tt> under which the template is run;;To;;0;[o; ;[I"Athe binding used to resolve local variables in the template.;T@o; ;[I"<See the ERB.new and ERB#result methods for more detail.;T@S; ; i;I"Character encodings;T@o; ;[ I"EERB (or ruby code generated by ERB) returns a string in the same;TI"Gcharacter encoding as the input string. When the input string has;TI"La magic comment, however, it returns a string in the encoding specified;TI"by the magic comment.;T@o;;[ I"# -*- coding: UTF-8 -*- ;FI"require 'erb' ;FI" ;FI"template = ERB.new <<EOF ;FI"<%#-*- coding: Big5 -*-%> ;FI"4 \_\_ENCODING\_\_ is <%= \_\_ENCODING\_\_ %>. ;FI" EOF ;FI"puts template.result ;Fo; ;[I"/<em>Prints:</em> \_\_ENCODING\_\_ is Big5.;T@S; ; i;I" Examples;T@S; ; i;I"Plain Text;T@o; ;[I"_ERB is useful for any generic templating situation. Note that in this example, we use the;TI"Rconvenient "% at start of line" tag, and we quote the template literally with;TI":<tt>%q{...}</tt> to avoid trouble with the backslash.;T@o;;[*I"require "erb" ;FI" ;FI"# Create template. ;FI"template = %q{ ;FI"? From: James Edward Gray II <james@grayproductions.net> ;FI" To: <%= to %> ;FI"" Subject: Addressing Needs ;FI" ;FI" <%= to[/\w+/] %>: ;FI" ;FI"K Just wanted to send a quick note assuring that your needs are being ;FI" addressed. ;FI" ;FI"H I want you to know that my team will keep working on the issues, ;FI" especially: ;FI" ;FI"D <%# ignore numerous minor requests -- focus on priorities %> ;FI"' % priorities.each do |priority| ;FI" * <%= priority %> ;FI" % end ;FI" ;FI"! Thanks for your patience. ;FI" ;FI" James Edward Gray II ;FI"}.gsub(/^ /, '') ;FI" ;FI"+message = ERB.new(template, 0, "%<>") ;FI" ;FI"# Set up template data. ;FI"?to = "Community Spokesman <spokesman@ruby_community.org>" ;FI"%priorities = [ "Run Ruby Quiz", ;FI"( "Document Modules", ;FI"6 "Answer Questions on Ruby Talk" ] ;FI" ;FI"# Produce result. ;FI"email = message.result ;FI"puts email ;Fo; ;[I"<i>Generates:</i>;T@o;;[I"=From: James Edward Gray II <james@grayproductions.net> ;FI"=To: Community Spokesman <spokesman@ruby_community.org> ;FI" Subject: Addressing Needs ;FI" ;FI"Community: ;FI" ;FI"TJust wanted to send a quick note assuring that your needs are being addressed. ;FI" ;FI"RI want you to know that my team will keep working on the issues, especially: ;FI" ;FI" * Run Ruby Quiz ;FI" * Document Modules ;FI") * Answer Questions on Ruby Talk ;FI" ;FI"Thanks for your patience. ;FI" ;FI"James Edward Gray II ;FS; ; i;I"Ruby in HTML;T@o; ;[I"^ERB is often used in <tt>.rhtml</tt> files (HTML with embedded Ruby). Notice the need in;TI"]this example to provide a special binding when the template is run, so that the instance;TI"5variables in the Product object can be resolved.;T@o;;[HI"require "erb" ;FI" ;FI""# Build template data class. ;FI"class Product ;FI"0 def initialize( code, name, desc, cost ) ;FI" @code = code ;FI" @name = name ;FI" @desc = desc ;FI" @cost = cost ;FI" ;FI" @features = [ ] ;FI" end ;FI" ;FI"" def add_feature( feature ) ;FI" @features << feature ;FI" end ;FI" ;FI", # Support templating of member data. ;FI" def get_binding ;FI" binding ;FI" end ;FI" ;FI" # ... ;FI" end ;FI" ;FI"# Create template. ;FI"template = %{ ;FI" <html> ;FI"? <head><title>Ruby Toys -- <%= @name %></title></head> ;FI" <body> ;FI" ;FI"0 <h1><%= @name %> (<%= @code %>)</h1> ;FI" <p><%= @desc %></p> ;FI" ;FI" <ul> ;FI") <% @features.each do |f| %> ;FI"( <li><b><%= f %></b></li> ;FI" <% end %> ;FI" </ul> ;FI" ;FI" <p> ;FI"! <% if @cost < 10 %> ;FI"+ <b>Only <%= @cost %>!!!</b> ;FI" <% else %> ;FI") Call for a price, today! ;FI" <% end %> ;FI" </p> ;FI" ;FI" </body> ;FI" </html> ;FI"}.gsub(/^ /, '') ;FI" ;FI"rhtml = ERB.new(template) ;FI" ;FI"# Set up template data. ;FI"#toy = Product.new( "TZ-1002", ;FI"& "Rubysapien", ;FI"M "Geek's Best Friend! Responds to Ruby commands...", ;FI"! 999.95 ) ;FI"Jtoy.add_feature("Listens for verbal commands in the Ruby language!") ;FI"@toy.add_feature("Ignores Perl, Java, and all C variants.") ;FI".toy.add_feature("Karate-Chop Action!!!") ;FI"4toy.add_feature("Matz signature on left leg.") ;FI"?toy.add_feature("Gem studded eyes... Rubies, of course!") ;FI" ;FI"# Produce result. ;FI" rhtml.run(toy.get_binding) ;Fo; ;[I"1<i>Generates (some blank lines removed):</i>;T@o;;[I"<html> ;FI"; <head><title>Ruby Toys -- Rubysapien</title></head> ;FI" <body> ;FI" ;FI"' <h1>Rubysapien (TZ-1002)</h1> ;FI"B <p>Geek's Best Friend! Responds to Ruby commands...</p> ;FI" ;FI" <ul> ;FI"O <li><b>Listens for verbal commands in the Ruby language!</b></li> ;FI"E <li><b>Ignores Perl, Java, and all C variants.</b></li> ;FI"3 <li><b>Karate-Chop Action!!!</b></li> ;FI"9 <li><b>Matz signature on left leg.</b></li> ;FI"D <li><b>Gem studded eyes... Rubies, of course!</b></li> ;FI" </ul> ;FI" ;FI" <p> ;FI"' Call for a price, today! ;FI" </p> ;FI" ;FI" </body> ;FI" </html> ;FS; ; i;I" Notes;T@o; ;[I"TThere are a variety of templating solutions available in various Ruby projects:;To;;;;[ o;;0;[o; ;[I"LERB's big brother, eRuby, works the same but is written in C for speed;;To;;0;[o; ;[I"*Amrita (smart at producing HTML/XML);;To;;0;[o; ;[I"*cs/Template (written in C for speed);;To;;0;[o; ;[I"^RDoc, distributed with Ruby, uses its own template engine, which can be reused elsewhere;;To;;0;[o; ;[I" and others; search the RAA.;T@o; ;[I"DRails, the web application framework, uses ERB to create views.;T: @fileI"lib/erb.rb;T;0[[ I" filename;FI"RW;F:publicF@2[ I"src;FI"R;F;F@2[[I" Revision;Fo;;[ ;0@2[ [[I" class;F[[;[[I"new;F@2[I"version;F@2[:protected[ [:private[ [I" instance;F[[;[[I"def_class;F@2[I"def_method;F@2[I"def_module;F@2[I"result;F@2[I"run;F@2[I"set_eoutvar;F@2[;[ [;[