File: //usr/local/rvm/gems/default/doc/erubi-1.10.0/ri/page-README_rdoc.ri
U:RDoc::TopLevel[ i I"README.rdoc:ETcRDoc::Parser::Simpleo:RDoc::Markup::Document:@parts[5S:RDoc::Markup::Heading:
leveli: textI"
Erubi;To:RDoc::Markup::BlankLine o:RDoc::Markup::Paragraph;[I"WErubi is a ERB template engine for ruby. It is a simplified fork of Erubis, using ;TI">the same basic algorithm, with the following differences:;T@
o:RDoc::Markup::List:
@type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;[o;
;[I"WHandles postfix conditionals when using escaping (e.g. <tt><%= foo if bar %></tt>);To;;0;[o;
;[I"ISupports frozen_string_literal: true in templates via :freeze option;To;;0;[o;
;[I"EWorks with ruby's <tt>--enable-frozen-string-literal</tt> option;To;;0;[o;
;[I"ZAutomatically freezes strings for template text when ruby optimizes it (on ruby 2.1+);To;;0;[o;
;[I"MEscapes <tt>'</tt> (apostrophe) when escaping for better XSS protection ;To;;0;[o;
;[I"<Has 6x faster escaping on ruby 2.3+ by using cgi/escape;To;;0;[o;
;[I"%Has 86% smaller memory footprint;To;;0;[o;
;[I"=Does no monkey patching (Erubis adds a method to Kernel);To;;0;[o;
;[I"dUses an immutable design (all options passed to the constructor, which returns a frozen object);To;;0;[o;
;[I"7Has simpler internals (1 file, <150 lines of code);To;;0;[o;
;[I"8Is not dead (Erubis hasn't been updated since 2011);T@
o;
;[I"RIt is not designed with Erubis API compatibility in mind, though most Erubis ;TI"5ERB syntax works, with the following exceptions:;T@
o;;;;[o;;0;[o;
;[I"3No support for <tt><%===</tt> for debug output;T@
S; ;
i;I"Installation;T@
o:RDoc::Markup::Verbatim;[I"gem install erubi
;T:@format0S; ;
i;I"Source Code;T@
o;
;[I"OSource code is available on GitHub at https://github.com/jeremyevans/erubi;T@
S; ;
i;I"
Usage;T@
o;
;[I"OErubi only has built in support for retrieving the generated source for a ;TI"
file:;T@
o;;[I"require 'erubi'
;TI"<eval(Erubi::Engine.new(File.read('filename.erb')).src)
;T;0o;
;[I"QMost users will probably use Erubi via Rails or Tilt. Erubi is the default ;TI"8erb template handler in Tilt 2.0.6+ and Rails 5.1+.;T@
S; ;
i;I"Capturing;T@
o;
;[ I"QErubi does not support capturing block output into the template by default. ;TI"PHowever, it comes with an +erubi/capture_end+ file that supports capturing ;TI"Gvia <tt><%|=</tt> and <tt><%|==</tt> tags which are closed with a ;TI"<tt><%|</tt> tag:;T@
o;;[I"<%|= form do %>
;TI" <input>
;TI"<%| end %>
;T;0o;
;[I"NThis offers similar functionality to that offered by Rails' <tt><%=</tt> ;TI"Mtags, but without the corner cases with that approach (which are due to ;TI"Oattempting to parse ruby code via a regexp). Similar to the <tt><%=</tt> ;TI"Cand <tt><%==</tt> tags, <tt><%|=</tt> captures by default and ;TI"N<tt><%|==</tt> captures and escapes by default, but this can be reversed ;TI"4via the +:escape_capture+ or +:escape+ options.;T@
o;
;[I".To use the capture_end support with tilt:;T@
o;;[I"require 'tilt'
;TI"!require 'erubi/capture_end'
;TI"MTilt.new("filename.erb", :engine_class=>Erubi::CaptureEndEngine).render
;T;0o;
;[I"TWhen using the capture_end support, any methods (such as +form+ in the example ;TI"Oabove) should return the (potentially modified) buffer. Since the buffer ;TI"Rvariable is a local variable and not an instance variable by default, you'll ;TI"Lprobably want to set the +:bufvar+ variable when using the capture_end ;TI"Lsupport to an instance variable, and have any methods used access that ;TI"!instance variable. Example:;T@
o;;[I"def form
;TI" @_buf << "<form>"
;TI"
yield
;TI" @_buf << "</form>"
;TI"
@_buf
;TI" end
;TI"
;TI"Iputs eval(Erubi::CaptureEndEngine.new(<<-END, :bufvar=>:@_buf).src)
;TI"before
;TI"<%|= form do %>
;TI"inside
;TI"<%| end %>
;TI"after
;TI" END
;TI"
;TI"# Output:
;TI"# before
;TI"# <form>
;TI"# inside
;TI"# </form>
;TI"
# after
;T;0o;
;[I"^Alternatively, passing the option <tt>:yield_returns_buffer => true</tt> will return the ;TI"Nbuffer captured by the block instead of the last expression in the block.;T@
S; ;
i;I"Reporting Bugs;T@
o;
;[I"NThe bug tracker is located at https://github.com/jeremyevans/erubi/issues;T@
S; ;
i;I"License;T@
o;
;[I"MIT;T@
S; ;
i;I"Authors;T@
o;
;[I")Jeremy Evans <code@jeremyevans.net> ;TI"kuwata-lab.com;T:
@file@:0@omit_headings_from_table_of_contents_below0