summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
author(no author) <(no author)@c9e70521-770b-0410-b9ac-ce6205b42a9f>2007-02-11 05:15:33 +0000
committer(no author) <(no author)@c9e70521-770b-0410-b9ac-ce6205b42a9f>2007-02-11 05:15:33 +0000
commited19bab600e363c2fa8c4b99f622795b2ac22656 (patch)
tree56f7ff9053cfaecd38ee0b03ddb35f08aa4dc732 /doc
parentebddcd7c58d624e4d50599800500efa31960724d (diff)
downloaderubis-ed19bab600e363c2fa8c4b99f622795b2ac22656.tar.gz
- [release] release preparation
Diffstat (limited to 'doc')
-rw-r--r--doc/users-guide.html59
1 files changed, 42 insertions, 17 deletions
diff --git a/doc/users-guide.html b/doc/users-guide.html
index 9d90677..5ab21cd 100644
--- a/doc/users-guide.html
+++ b/doc/users-guide.html
@@ -43,7 +43,7 @@ It has the following features.
</li>
<li>Easy to expand and customize in subclass
</li>
-<li>Ruby on Rails support
+<li><a href="#topics-rails">Ruby on Rails support</a>
</li>
</ul>
<p>Erubis is implemented in pure Ruby. It requires Ruby 1.8 or higher.
@@ -1946,11 +1946,11 @@ document.write(_buf.join(""));
<h2 class="section1">Other Topics</h2>
<a name="topics-syntax"></a>
<h3 class="section2">Syntax Checking</h3>
-<p>Command-line option '-X' checks syntax. It is similar to 'erubis -x file.rhtml | ruby -wc', but it can take several file names.
+<p>Command-line option '-z' checks syntax. It is similar to 'erubis -x file.rhtml | ruby -wc', but it can take several file names.
</p>
<div class="terminal_caption">
-example of command-line option '-X'</div>
-<pre class="terminal">$ erubis <strong>-X</strong> app/views/*/*.rhtml
+example of command-line option '-z'</div>
+<pre class="terminal">$ erubis <strong>-z</strong> app/views/*/*.rhtml
Syntax OK
</pre>
<br>
@@ -1989,7 +1989,7 @@ try Erubis::TinyEruby class.
<a name="topics-rails"></a>
<h3 class="section2">Ruby on Rails Support</h3>
-<p>Erubis supports Ruby on Rails.
+<p>Erubis supports Ruby on Rails. ActionView::Helpers::CaptureHelper#capture() and ActionView::Helpers::Texthelper#concat() are available.
</p>
<ol type="1">
<li>Add the following code to your 'config/environment.rb'.
@@ -2001,6 +2001,10 @@ config/environment.rb</div>
#Erubis::Helpers::RailsHelper.show_src = false
</pre>
</li>
+</ol>
+<p> This will replace ERB in Rails by Erubis entirely.
+</p>
+<ol type="1">
<li>(Optional) apply the following patch to 'action_pack/lib/action_view/base.rb'.
<div class="program_caption">
action_view_base_rb.patch</div>
@@ -2028,7 +2032,7 @@ action_view_base_rb.patch</div>
@@template_args[render_symbol] ||= {}
</pre>
-<p> This patch is included in erubis_X.X.X/contrib directory and the following is an
+<p> This patch is included in erubis_2.X.X/contrib directory and the following is an
example to apply this patch.
</p>
<div class="terminal_caption">
@@ -2038,7 +2042,7 @@ $ sudo patch -p1 &lt; /tmp/erubis_2.X.X/contrib/action_view_base_rb.patch
</pre>
</li>
</ol>
-<p> Notice that this patch is optinal if you are using Ruby on Rails ver 1.1 or 1.2.
+<p> Notice that this patch is not necessary if you are using Ruby on Rails ver 1.1 or 1.2, but it is recommended.
</p>
<ol type="1">
<li>Restart web server.
@@ -2246,15 +2250,16 @@ MacOS X 10.4 Tiger, Intel CoreDuo 1.83GHz, Ruby1.8.5, eruby1.0.5, gcc4.0.1</div>
$ ruby erubybench.rb -n 10000 -m execute
## execute
user system total real
-eruby 24.460000 0.600000 25.060000 ( 29.248518)
-ERB 65.190000 1.060000 66.250000 ( 77.053693)
-Erubis::Eruby 21.450000 0.700000 22.150000 ( 26.237943)
-Erubis::Eruby(cached) 14.440000 0.850000 15.290000 ( 18.152723)
-Erubis::ArrayBufferEruby 21.730000 0.710000 22.440000 ( 26.861644)
-Erubis::SimplifiedEruby 19.620000 0.660000 20.280000 ( 23.159973)
-Erubis::StdoutEruby 22.810000 0.690000 23.500000 ( 26.590015)
-Erubis::PrintOutEruby 22.590000 0.680000 23.270000 ( 26.336551)
-Erubis::TinyEruby 18.370000 0.660000 19.030000 ( 21.475423)
+eruby 23.270000 0.540000 23.810000 ( 33.621505)
+ERB 68.170000 0.930000 69.100000 ( 77.182647)
+Erubis::Eruby 20.650000 0.640000 21.290000 ( 23.776704)
+Erubis::Eruby(cached) 13.780000 0.810000 14.590000 ( 16.420384)
+Erubis::ArrayBufferEruby 20.920000 0.650000 21.570000 ( 24.031593)
+Erubis::SimplifiedEruby 18.830000 0.620000 19.450000 ( 21.792011)
+Erubis::StdoutEruby 22.070000 0.650000 22.720000 ( 25.483154)
+Erubis::PrintOutEruby 21.930000 0.640000 22.570000 ( 25.272523)
+Erubis::TinyEruby 17.620000 0.620000 18.240000 ( 20.641452)
+Erubis::PI::Eruby 21.840000 0.650000 22.490000 ( 25.242539)
</pre>
<p>This shows that...
</p>
@@ -2272,6 +2277,26 @@ Erubis::TinyEruby 18.370000 0.660000 19.030000 ( 21.475423)
<li>Erubis::TinyEruby (at 'erubis/tiny.rb') is the fastest in all eRuby implementations when no caching.
</li>
</ul>
+<p>Escaping HTML characters (such as '&lt; &gt; &amp; "') makes Erubis more faster than eruby and ERB,
+because Erubis::XmlHelper.escape_html() works faster than CGI.escapeHTML() and ERB::Util.h().
+The following shows that Erubis is more than 30 percent faster than eruby.
+</p>
+<div class="terminal_caption">
+When escaping HTML characters with option '-e'</div>
+<pre class="terminal">$ ruby erubybench.rb -n 10000 -m execute -e
+## execute
+ user system total real
+eruby 41.800000 0.820000 42.620000 ( 45.547137)
+ERB 86.030000 1.340000 87.370000 ( 92.739382)
+Erubis::Eruby 30.960000 0.820000 31.780000 ( 33.783879)
+Erubis::Eruby(cached) 23.150000 0.970000 24.120000 ( 25.599809)
+Erubis::ArrayBufferEruby 31.180000 0.830000 32.010000 ( 33.815682)
+Erubis::SimplifiedEruby 29.120000 0.810000 29.930000 ( 31.788697)
+Erubis::StdoutEruby 32.670000 0.840000 33.510000 ( 35.592838)
+Erubis::PrintOutEruby 32.560000 0.850000 33.410000 ( 35.365003)
+Erubis::TinyEruby 30.220000 0.810000 31.030000 ( 32.996905)
+Erubis::PI::Eruby 31.880000 0.850000 32.730000 ( 35.329514)
+</pre>
<br>
@@ -2306,7 +2331,7 @@ Erubis::TinyEruby 18.370000 0.660000 19.030000 ( 21.475423)
Show compiled source.
</dd>
<dt class="dt3"><b>
--X </b></dt>
+-z </b></dt>
<dd class="dd3">
Syntax checking.
</dd>