| Server IP : 162.214.74.102 / Your IP : 216.73.217.46 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/opt/cpanel/ea-ruby24/root/usr/share/ri/system/ERB/ |
Upload File : |
U:RDoc::AnyMethod[iI"new:ETI"
ERB::new;TT:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"FConstructs a new ERB object with the template specified in _str_.;To:RDoc::Markup::BlankLine o;
; [ I"KAn ERB object works by building a chunk of Ruby code that will output ;TI"Qthe completed template when run. If _safe_level_ is set to a non-nil value, ;TI"LERB code will be run in a separate thread with <b>$SAFE</b> set to the ;TI"provided level.;T@o;
; [I"OIf _trim_mode_ is passed a String containing one or more of the following ;TI">modifiers, ERB will adjust its code generation as listed:;T@o:RDoc::Markup::Verbatim; [ I"@% enables Ruby code processing for lines beginning with %
;TI"A<> omit newline for lines starting with <% and ending in %>
;TI",> omit newline for lines ending in %>
;TI"'- omit blank lines ending in -%>
;T:@format0o;
; [ I"M_eoutvar_ can be used to set the name of the variable ERB will build up ;TI"Fits output in. This is useful when you need to run multiple ERB ;TI"Ntemplates through the same binding and/or when you want to control where ;TI"Ooutput ends up. Pass the name of the variable to be used inside a String.;T@S:RDoc::Markup::Heading:
leveli: textI"Example;T@o;; ['I"require "erb"
;TI"
;TI"# build data class
;TI"class Listings
;TI"3 PRODUCT = { :name => "Chicken Fried Steak",
;TI"J :desc => "A well messages pattie, breaded and fried.",
;TI"# :cost => 9.95 }
;TI"
;TI"$ attr_reader :product, :price
;TI"
;TI"2 def initialize( product = "", price = "" )
;TI" @product = product
;TI" @price = price
;TI" end
;TI"
;TI" def build
;TI" b = binding
;TI"C # create and run templates, filling member data variables
;TI"P ERB.new(<<-'END_PRODUCT'.gsub(/^\s+/, ""), 0, "", "@product").result b
;TI"! <%= PRODUCT[:name] %>
;TI"! <%= PRODUCT[:desc] %>
;TI" END_PRODUCT
;TI"L ERB.new(<<-'END_PRICE'.gsub(/^\s+/, ""), 0, "", "@price").result b
;TI": <%= PRODUCT[:name] %> -- <%= PRODUCT[:cost] %>
;TI"! <%= PRODUCT[:desc] %>
;TI" END_PRICE
;TI" end
;TI" end
;TI"
;TI"# setup template data
;TI"listings = Listings.new
;TI"listings.build
;TI"
;TI"3puts listings.product + "\n" + listings.price
;T;
0o;
; [I"_Generates_;T@o;; [
I"Chicken Fried Steak
;TI"0A well messages pattie, breaded and fried.
;TI"
;TI"!Chicken Fried Steak -- 9.95
;TI"/A well messages pattie, breaded and fried.;T;
0:
@fileI"lib/erb.rb;T:0@omit_headings_from_table_of_contents_below000[ I"<(str, safe_level=nil, trim_mode=nil, eoutvar='_erbout');T@UFI"ERB;TcRDoc::NormalClass00