Skip to content

Commit

Permalink
[update] 'doc/users-guide.{txt,html}'
Browse files Browse the repository at this point in the history
  • Loading branch information
kwatch committed Mar 21, 2011
1 parent cd532bf commit 772b3fc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
22 changes: 11 additions & 11 deletions doc/users-guide.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ <h3 class="section2">Table of Contents</h3>
<ul>
<li><a href="#topics-fasteruby"><code>Erubis::FastEruby</code> Class</a>
</li>
<li><a href="#topics-bufname"><code>:bufname</code> Option</a>
<li><a href="#topics-bufvar"><code>:bufvar</code> Option</a>
</li>
<li><a href="#topics-trimspaces">'&lt;%= =%&gt;' and '&lt;%= -%&gt;'</a>
</li>
Expand Down Expand Up @@ -2717,28 +2717,28 @@ <h3 class="section2"><code>Erubis::FastEruby</code> Class</h3>
<br>


<a name="topics-bufname"></a>
<h3 class="section2"><code>:bufname</code> Option</h3>
<p>Since 2.7.0, Erubis supports <code>:bufname</code> option which allows you to change buffer variable name (default '<code>_buf</code>').
<a name="topics-bufvar"></a>
<h3 class="section2"><code>:bufvar</code> Option</h3>
<p>Since 2.7.0, Erubis supports <code>:bufvar</code> option which allows you to change buffer variable name (default '<code>_buf</code>').
</p>
<a name="bufname-example.rb"></a>
<a name="bufvar-example.rb"></a>
<div class="program_caption">
bufname-example.rb</div>
bufvar-example.rb</div>
<pre class="program">require 'erubis'
input = File.read('example.eruby')

puts "----- default -----"
eruby = Erubis::FastEruby.new(input)
puts eruby.src

puts "----- with :bufname option -----"
eruby = Erubis::FastEruby.new(input, <strong>:bufname=&gt;'@_out_buf'</strong>)
puts "----- with :bufvar option -----"
eruby = Erubis::FastEruby.new(input, <strong>:bufvar=&gt;'@_out_buf'</strong>)
print eruby.src
</pre>
<a name="bufname-example.result"></a>
<a name="bufvar-example.result"></a>
<div class="terminal_caption">
result</div>
<pre class="terminal">$ ruby bufname-example.rb
<pre class="terminal">$ ruby bufvar-example.rb
----- default -----
_buf = ''; _buf &lt;&lt; %Q`&lt;div&gt;\n`
for item in list
Expand All @@ -2747,7 +2747,7 @@ <h3 class="section2"><code>:bufname</code> Option</h3>
end
_buf &lt;&lt; %Q`&lt;/div&gt;\n`
_buf.to_s
----- with :bufname option -----
----- with :bufvar option -----
<strong>@_out_buf</strong> = ''; <strong>@_out_buf</strong> &lt;&lt; %Q`&lt;div&gt;\n`
for item in list
<strong>@_out_buf</strong> &lt;&lt; %Q` &lt;p&gt;#{ item }&lt;/p&gt;
Expand Down
18 changes: 9 additions & 9 deletions doc/users-guide.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2825,27 +2825,27 @@ _buf.to_s
Technically, {{,Erubis::FastEruby,}} is just a subclass of {{,Erubis::Eruby,}} and includes {{,{{<InterpolationEnhancer|#interpolation-enhancer>}},}}. {{,Erubis::FastEruby,}} is faster than {{,Erubis::Eruby,}} but is not extensible compared to {{,Erubis::Eruby,}}. This is the reason why {{,Erubis::FastEruby,}} is not the default class of Erubis.


.$$ {{,:bufname,}} Option | topics-bufname
.$$ {{,:bufvar,}} Option | topics-bufvar

Since 2.7.0, Erubis supports {{,:bufname,}} option which allows you to change buffer variable name (default '{{,_buf,}}').
Since 2.7.0, Erubis supports {{,:bufvar,}} option which allows you to change buffer variable name (default '{{,_buf,}}').

.? bufname-example.rb
.-------------------- bufname-example.rb
.? bufvar-example.rb
.-------------------- bufvar-example.rb
require 'erubis'
input = File.read('example.eruby')

puts "----- default -----"
eruby = Erubis::FastEruby.new(input)
puts eruby.src

puts "----- with :bufname option -----"
eruby = Erubis::FastEruby.new(input, {{*:bufname=>'@_out_buf'*}})
puts "----- with :bufvar option -----"
eruby = Erubis::FastEruby.new(input, {{*:bufvar=>'@_out_buf'*}})
print eruby.src
.--------------------

.? result
.==================== bufname-example.result
$ ruby bufname-example.rb
.==================== bufvar-example.result
$ ruby bufvar-example.rb
----- default -----
_buf = ''; _buf << %Q`<div>\n`
for item in list
Expand All @@ -2854,7 +2854,7 @@ _buf = ''; _buf << %Q`<div>\n`
end
_buf << %Q`</div>\n`
_buf.to_s
----- with :bufname option -----
----- with :bufvar option -----
{{*@_out_buf*}} = ''; {{*@_out_buf*}} << %Q`<div>\n`
for item in list
{{*@_out_buf*}} << %Q` <p>#{ item }</p>
Expand Down

0 comments on commit 772b3fc

Please sign in to comment.