erubis 2.6.1 → 2.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/CHANGES.txt +16 -2
  2. data/README.txt +2 -1
  3. data/benchmark/bench.rb +1 -1
  4. data/bin/erubis +1 -1
  5. data/contrib/erubis +1 -1
  6. data/contrib/inline-require +1 -1
  7. data/doc-api/classes/Erubis.html +1 -1
  8. data/doc-api/classes/Erubis/Basic/Converter.html +3 -2
  9. data/doc-api/classes/Erubis/BiPatternEnhancer.html +6 -3
  10. data/doc-api/classes/Erubis/DeleteIndentEnhancer.html +1 -1
  11. data/doc-api/classes/Erubis/HeaderFooterEnhancer.html +6 -3
  12. data/doc-api/classes/Erubis/InterpolationEnhancer.html +7 -6
  13. data/doc-api/classes/Erubis/Main.html +26 -26
  14. data/doc-api/classes/Erubis/PI/Converter.html +5 -4
  15. data/doc-api/classes/Erubis/PI/TinyEruby.html +6 -5
  16. data/doc-api/classes/Erubis/PercentLineEnhancer.html +3 -2
  17. data/doc-api/classes/Erubis/RubyEvaluator.html +18 -13
  18. data/doc-api/classes/Erubis/SimplifyEnhancer.html +2 -1
  19. data/doc-api/classes/Erubis/TinyEruby.html +4 -3
  20. data/doc-api/created.rid +1 -1
  21. data/doc-api/files/README_txt.html +4 -3
  22. data/doc-api/files/erubis/context_rb.html +1 -1
  23. data/doc-api/files/erubis/converter_rb.html +2 -2
  24. data/doc-api/files/erubis/engine/ec_rb.html +1 -1
  25. data/doc-api/files/erubis/engine/ejava_rb.html +1 -1
  26. data/doc-api/files/erubis/engine/ejavascript_rb.html +1 -1
  27. data/doc-api/files/erubis/engine/enhanced_rb.html +1 -1
  28. data/doc-api/files/erubis/engine/eperl_rb.html +1 -1
  29. data/doc-api/files/erubis/engine/ephp_rb.html +1 -1
  30. data/doc-api/files/erubis/engine/eruby_rb.html +1 -1
  31. data/doc-api/files/erubis/engine/escheme_rb.html +1 -1
  32. data/doc-api/files/erubis/engine/optimized_rb.html +1 -1
  33. data/doc-api/files/erubis/engine_rb.html +1 -1
  34. data/doc-api/files/erubis/enhancer_rb.html +2 -2
  35. data/doc-api/files/erubis/error_rb.html +1 -1
  36. data/doc-api/files/erubis/evaluator_rb.html +2 -2
  37. data/doc-api/files/erubis/generator_rb.html +1 -1
  38. data/doc-api/files/erubis/helper_rb.html +1 -1
  39. data/doc-api/files/erubis/helpers/rails_form_helper_rb.html +1 -1
  40. data/doc-api/files/erubis/helpers/rails_helper_rb.html +1 -1
  41. data/doc-api/files/erubis/local-setting_rb.html +1 -1
  42. data/doc-api/files/erubis/main_rb.html +2 -2
  43. data/doc-api/files/erubis/preprocessing_rb.html +1 -1
  44. data/doc-api/files/erubis/tiny_rb.html +2 -2
  45. data/doc-api/files/erubis_rb.html +1 -1
  46. data/doc/users-guide.html +13 -11
  47. data/lib/erubis.rb +2 -2
  48. data/lib/erubis/context.rb +1 -1
  49. data/lib/erubis/converter.rb +6 -4
  50. data/lib/erubis/engine.rb +1 -1
  51. data/lib/erubis/engine/ec.rb +1 -1
  52. data/lib/erubis/engine/ejava.rb +1 -1
  53. data/lib/erubis/engine/ejavascript.rb +1 -1
  54. data/lib/erubis/engine/enhanced.rb +1 -1
  55. data/lib/erubis/engine/eperl.rb +1 -1
  56. data/lib/erubis/engine/ephp.rb +1 -1
  57. data/lib/erubis/engine/eruby.rb +1 -1
  58. data/lib/erubis/engine/escheme.rb +1 -1
  59. data/lib/erubis/engine/optimized.rb +1 -1
  60. data/lib/erubis/enhancer.rb +16 -7
  61. data/lib/erubis/error.rb +1 -1
  62. data/lib/erubis/evaluator.rb +17 -12
  63. data/lib/erubis/generator.rb +1 -1
  64. data/lib/erubis/helper.rb +1 -1
  65. data/lib/erubis/helpers/rails_form_helper.rb +1 -1
  66. data/lib/erubis/helpers/rails_helper.rb +1 -1
  67. data/lib/erubis/local-setting.rb +1 -1
  68. data/lib/erubis/main.rb +32 -31
  69. data/lib/erubis/preprocessing.rb +1 -1
  70. data/lib/erubis/tiny.rb +6 -4
  71. data/test/assert-text-equal.rb +1 -1
  72. data/test/assert-text-equal.rbc +0 -0
  73. data/test/data/users-guide/example1.rb +1 -0
  74. data/test/data/users-guide/main_program2.result +1 -1
  75. data/test/hoge.rb +5 -0
  76. data/test/test-engines.rb +5 -2
  77. data/test/test-engines.rbc +0 -0
  78. data/test/test-enhancers.rb +4 -2
  79. data/test/test-erubis.rb +11 -5
  80. data/test/test-erubis.rbc +0 -0
  81. data/test/test-main.rb +27 -6
  82. data/test/test-users-guide.rb +4 -2
  83. data/test/test-users-guide.rbc +0 -0
  84. data/test/test.rb +1 -1
  85. data/test/test.rbc +0 -0
  86. data/test/testutil.rb +29 -3
  87. data/test/testutil.rbc +0 -0
  88. metadata +9 -4
  89. data/lib/erubis/converter.rb: +0 -0
  90. data/test/data/users-guide/stderr.log +0 -3
@@ -1,7 +1,21 @@
1
- # $Rev: 113 $
2
- # $Release: 2.6.1 $
1
+ # -*- coding: utf-8 -*-
2
+ # $Rev: 118 $
3
+ # $Release: 2.6.2 $
3
4
  # copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
4
5
 
6
+ - release: 2.6.2
7
+ date: 2008-06-12
8
+ enhancements:
9
+
10
+ - |
11
+ Ruby 1.9 support.
12
+
13
+ bugfixes:
14
+
15
+ - |
16
+ Fixed a bug that it is not able to install Erubis on windows
17
+ (Thanks to Tim Morgan and Allen).
18
+
5
19
 
6
20
  - release: 2.6.1
7
21
  date: 2008-06-06
data/README.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  = README
2
2
 
3
- release:: 2.6.1
3
+ release:: 2.6.2
4
4
  copyright:: copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
5
5
 
6
6
 
@@ -20,6 +20,7 @@ Erubis is an implementation of eRuby. It has the following features.
20
20
  * Ruby on Rails support
21
21
 
22
22
  Erubis is implemented in pure Ruby. It requires Ruby 1.8 or higher.
23
+ Erubis now supports Ruby 1.9.
23
24
 
24
25
  See doc/users-guide.html for details.
25
26
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  ###
4
4
  ### $Rev: 101 $
5
- ### $Release: 2.6.1 $
5
+ ### $Release: 2.6.2 $
6
6
  ### copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
7
7
  ###
8
8
 
data/bin/erubis CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ###
4
4
  ### $Rev: 77 $
5
- ### $Release: 2.6.1 $
5
+ ### $Release: 2.6.2 $
6
6
  ### copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
7
7
  ###
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  ###
4
4
  ### $Rev: 77 $
5
- ### $Release: 2.6.1 $
5
+ ### $Release: 2.6.2 $
6
6
  ### copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
7
7
  ###
8
8
 
@@ -6,7 +6,7 @@
6
6
  ### usage: inline-require [-h] [-I path[,path2,..]] script
7
7
  ###
8
8
  ### copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
9
- ### 2.6.1
9
+ ### 2.6.2
10
10
  ### $Rev: 2 $
11
11
  ###
12
12
 
@@ -328,7 +328,7 @@ Class <a href="Erubis/XmlEruby.html" class="link">Erubis::XmlEruby</a><br />
328
328
  <tr class="top-aligned-row context-row">
329
329
  <td class="context-item-name">VERSION</td>
330
330
  <td>=</td>
331
- <td class="context-item-value">('$Release: 2.6.1 $' =~ /([.\d]+)/) &amp;&amp; $1</td>
331
+ <td class="context-item-value">('$Release: 2.6.2 $' =~ /([.\d]+)/) &amp;&amp; $1</td>
332
332
  </tr>
333
333
  </table>
334
334
  </div>
@@ -173,7 +173,7 @@ add expression code to src
173
173
  onclick="toggleCode('M000061-source');return false;">[Source]</a></p>
174
174
  <div class="method-source-code" id="M000061-source">
175
175
  <pre>
176
- <span class="ruby-comment cmt"># File erubis/converter.rb, line 176</span>
176
+ <span class="ruby-comment cmt"># File erubis/converter.rb, line 177</span>
177
177
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>, <span class="ruby-identifier">indicator</span>)
178
178
  <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">indicator</span>
179
179
  <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'='</span>
@@ -247,7 +247,8 @@ add expression code to src
247
247
  <span class="ruby-keyword kw">end</span>
248
248
  <span class="ruby-keyword kw">end</span>
249
249
  <span class="ruby-keyword kw">end</span>
250
- <span class="ruby-identifier">rest</span> = <span class="ruby-identifier">$'</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">input</span> <span class="ruby-comment cmt"># add input when no matched</span>
250
+ <span class="ruby-comment cmt">#rest = $' || input # ruby1.8</span>
251
+ <span class="ruby-identifier">rest</span> = <span class="ruby-identifier">pos</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">input</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">input</span>[<span class="ruby-identifier">pos</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-comment cmt"># ruby1.9</span>
251
252
  <span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">rest</span>)
252
253
  <span class="ruby-keyword kw">end</span>
253
254
  </pre>
@@ -156,7 +156,7 @@ this is language independent.
156
156
  onclick="toggleCode('M000164-source');return false;">[Source]</a></p>
157
157
  <div class="method-source-code" id="M000164-source">
158
158
  <pre>
159
- <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 408</span>
159
+ <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 409</span>
160
160
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">input</span>, <span class="ruby-identifier">properties</span>={})
161
161
  <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bipattern</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:bipattern</span>] <span class="ruby-comment cmt"># or '\$\{ \}'</span>
162
162
  <span class="ruby-keyword kw">super</span>
@@ -182,14 +182,17 @@ this is language independent.
182
182
  onclick="toggleCode('M000165-source');return false;">[Source]</a></p>
183
183
  <div class="method-source-code" id="M000165-source">
184
184
  <pre>
185
- <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 420</span>
185
+ <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 421</span>
186
186
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">text</span>)
187
187
  <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">text</span>
188
+ <span class="ruby-identifier">m</span> = <span class="ruby-keyword kw">nil</span>
188
189
  <span class="ruby-identifier">text</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-ivar">@bipattern_regexp</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">txt</span>, <span class="ruby-identifier">indicator</span>, <span class="ruby-identifier">code</span><span class="ruby-operator">|</span>
190
+ <span class="ruby-identifier">m</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
189
191
  <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">txt</span>)
190
192
  <span class="ruby-identifier">add_expr</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>, <span class="ruby-value str">'='</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">indicator</span>)
191
193
  <span class="ruby-keyword kw">end</span>
192
- <span class="ruby-identifier">rest</span> = <span class="ruby-identifier">$'</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">text</span>
194
+ <span class="ruby-comment cmt">#rest = $' || text # ruby1.8</span>
195
+ <span class="ruby-identifier">rest</span> = <span class="ruby-identifier">m</span> <span class="ruby-value">? </span><span class="ruby-identifier">text</span>[<span class="ruby-identifier">m</span>.<span class="ruby-identifier">end</span>(<span class="ruby-value">0</span>)<span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-operator">:</span> <span class="ruby-identifier">text</span> <span class="ruby-comment cmt"># ruby1.9</span>
193
196
  <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">rest</span>)
194
197
  <span class="ruby-keyword kw">end</span>
195
198
  </pre>
@@ -125,7 +125,7 @@ this is language-independent.
125
125
  onclick="toggleCode('M000194-source');return false;">[Source]</a></p>
126
126
  <div class="method-source-code" id="M000194-source">
127
127
  <pre>
128
- <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 571</span>
128
+ <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 579</span>
129
129
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert_input</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">input</span>)
130
130
  <span class="ruby-identifier">input</span> = <span class="ruby-identifier">input</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/^[ \t]+&lt;/</span>, <span class="ruby-value str">'&lt;'</span>)
131
131
  <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">input</span>)
@@ -207,9 +207,11 @@ this is language-independent.
207
207
  onclick="toggleCode('M000125-source');return false;">[Source]</a></p>
208
208
  <div class="method-source-code" id="M000125-source">
209
209
  <pre>
210
- <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 537</span>
210
+ <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 542</span>
211
211
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">text</span>)
212
+ <span class="ruby-identifier">m</span> = <span class="ruby-keyword kw">nil</span>
212
213
  <span class="ruby-identifier">text</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-constant">HEADER_FOOTER_PATTERN</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">txt</span>, <span class="ruby-identifier">lspace</span>, <span class="ruby-identifier">word</span>, <span class="ruby-identifier">content</span>, <span class="ruby-identifier">rspace</span><span class="ruby-operator">|</span>
214
+ <span class="ruby-identifier">m</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
213
215
  <span class="ruby-identifier">flag_trim</span> = <span class="ruby-ivar">@trim</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">lspace</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">rspace</span>
214
216
  <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">txt</span>)
215
217
  <span class="ruby-identifier">content</span> = <span class="ruby-node">&quot;#{lspace}#{content}#{rspace}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">flag_trim</span>
@@ -217,7 +219,8 @@ this is language-independent.
217
219
  <span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-node">&quot;@#{word}&quot;</span>, <span class="ruby-identifier">content</span>)
218
220
  <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">rspace</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">flag_trim</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">rspace</span>
219
221
  <span class="ruby-keyword kw">end</span>
220
- <span class="ruby-identifier">rest</span> = <span class="ruby-identifier">$'</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">text</span>
222
+ <span class="ruby-comment cmt">#rest = $' || text # ruby1.8</span>
223
+ <span class="ruby-identifier">rest</span> = <span class="ruby-identifier">m</span> <span class="ruby-value">? </span><span class="ruby-identifier">text</span>[<span class="ruby-identifier">m</span>.<span class="ruby-identifier">end</span>(<span class="ruby-value">0</span>)<span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-operator">:</span> <span class="ruby-identifier">text</span> <span class="ruby-comment cmt"># ruby1.9</span>
221
224
  <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">rest</span>)
222
225
  <span class="ruby-keyword kw">end</span>
223
226
  </pre>
@@ -239,7 +242,7 @@ this is language-independent.
239
242
  onclick="toggleCode('M000126-source');return false;">[Source]</a></p>
240
243
  <div class="method-source-code" id="M000126-source">
241
244
  <pre>
242
- <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 552</span>
245
+ <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 560</span>
243
246
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">input</span>)
244
247
  <span class="ruby-identifier">source</span> = <span class="ruby-keyword kw">super</span>
245
248
  <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@src</span> = <span class="ruby-node">&quot;#{@header}#{source}#{@footer}&quot;</span>
@@ -130,7 +130,7 @@ this is only for <a href="Eruby.html">Eruby</a>.
130
130
  onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
131
131
  <div class="method-source-code" id="M000022-source">
132
132
  <pre>
133
- <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 655</span>
133
+ <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 664</span>
134
134
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_add_text_to_str</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">text</span>)
135
135
  <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">text</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">empty?</span>
136
136
  <span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/['\#\\]/</span>, <span class="ruby-value str">'\\\\\&amp;'</span>)
@@ -155,7 +155,7 @@ this is only for <a href="Eruby.html">Eruby</a>.
155
155
  onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
156
156
  <div class="method-source-code" id="M000023-source">
157
157
  <pre>
158
- <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 661</span>
158
+ <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 670</span>
159
159
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_escaped</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">code</span>)
160
160
  <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;\#{#{escaped_expr(code)}}&quot;</span>
161
161
  <span class="ruby-keyword kw">end</span>
@@ -178,7 +178,7 @@ this is only for <a href="Eruby.html">Eruby</a>.
178
178
  onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
179
179
  <div class="method-source-code" id="M000024-source">
180
180
  <pre>
181
- <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 665</span>
181
+ <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 674</span>
182
182
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">code</span>)
183
183
  <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;\#{#{code}}&quot;</span>
184
184
  <span class="ruby-keyword kw">end</span>
@@ -201,7 +201,7 @@ this is only for <a href="Eruby.html">Eruby</a>.
201
201
  onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
202
202
  <div class="method-source-code" id="M000021-source">
203
203
  <pre>
204
- <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 644</span>
204
+ <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 653</span>
205
205
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">text</span>)
206
206
  <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">text</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">empty?</span>
207
207
  <span class="ruby-comment cmt">#src &lt;&lt; &quot; _buf &lt;&lt; %Q`&quot; &lt;&lt; text &lt;&lt; &quot;`;&quot;</span>
@@ -231,7 +231,7 @@ this is only for <a href="Eruby.html">Eruby</a>.
231
231
  onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
232
232
  <div class="method-source-code" id="M000020-source">
233
233
  <pre>
234
- <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 590</span>
234
+ <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 598</span>
235
235
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert_input</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">input</span>)
236
236
  <span class="ruby-identifier">pat</span> = <span class="ruby-ivar">@pattern</span>
237
237
  <span class="ruby-identifier">regexp</span> = <span class="ruby-identifier">pat</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">pat</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'&lt;% %&gt;'</span> <span class="ruby-operator">?</span> <span class="ruby-constant">Basic</span><span class="ruby-operator">::</span><span class="ruby-constant">Converter</span><span class="ruby-operator">::</span><span class="ruby-constant">DEFAULT_REGEXP</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">pattern_regexp</span>(<span class="ruby-identifier">pat</span>)
@@ -281,7 +281,8 @@ this is only for <a href="Eruby.html">Eruby</a>.
281
281
  <span class="ruby-keyword kw">end</span>
282
282
  <span class="ruby-keyword kw">end</span>
283
283
  <span class="ruby-keyword kw">end</span>
284
- <span class="ruby-identifier">rest</span> = <span class="ruby-identifier">$'</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">input</span> <span class="ruby-comment cmt"># add input when no matched</span>
284
+ <span class="ruby-comment cmt">#rest = $' || input # ruby1.8</span>
285
+ <span class="ruby-identifier">rest</span> = <span class="ruby-identifier">pos</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">input</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">input</span>[<span class="ruby-identifier">pos</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-comment cmt"># ruby1.9</span>
285
286
  <span class="ruby-identifier">_add_text_to_str</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">rest</span>)
286
287
  <span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">str</span>)
287
288
  <span class="ruby-keyword kw">end</span>
@@ -171,34 +171,34 @@ ex.
171
171
  <span class="ruby-ivar">@single_options</span> = <span class="ruby-value str">&quot;hvxztTSbeBXNUC&quot;</span>
172
172
  <span class="ruby-ivar">@arg_options</span> = <span class="ruby-value str">&quot;pcrfKIlaE&quot;</span> <span class="ruby-comment cmt">#C</span>
173
173
  <span class="ruby-ivar">@option_names</span> = {
174
- <span class="ruby-value">?h</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:help</span>,
175
- <span class="ruby-value">?v</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:version</span>,
176
- <span class="ruby-value">?x</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:source</span>,
177
- <span class="ruby-value">?z</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:syntax</span>,
178
- <span class="ruby-value">?T</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:unexpand</span>,
179
- <span class="ruby-value">?t</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:untabify</span>, <span class="ruby-comment cmt"># obsolete</span>
180
- <span class="ruby-value">?S</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:intern</span>,
181
- <span class="ruby-value">?b</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:bodyonly</span>,
182
- <span class="ruby-value">?B</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:binding</span>,
183
- <span class="ruby-value">?p</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:pattern</span>,
184
- <span class="ruby-value">?c</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:context</span>,
185
- <span class="ruby-comment cmt">#?C =&gt; :class,</span>
186
- <span class="ruby-value">?e</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:escape</span>,
187
- <span class="ruby-value">?r</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:requires</span>,
188
- <span class="ruby-value">?f</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:datafiles</span>,
189
- <span class="ruby-value">?K</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:kanji</span>,
190
- <span class="ruby-value">?I</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:includes</span>,
191
- <span class="ruby-value">?l</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:lang</span>,
192
- <span class="ruby-value">?a</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:action</span>,
193
- <span class="ruby-value">?E</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:enhancers</span>,
194
- <span class="ruby-value">?X</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:notext</span>,
195
- <span class="ruby-value">?N</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:linenum</span>,
196
- <span class="ruby-value">?U</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:unique</span>,
197
- <span class="ruby-value">?C</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:compact</span>,
174
+ <span class="ruby-value str">'h'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:help</span>,
175
+ <span class="ruby-value str">'v'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:version</span>,
176
+ <span class="ruby-value str">'x'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:source</span>,
177
+ <span class="ruby-value str">'z'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:syntax</span>,
178
+ <span class="ruby-value str">'T'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:unexpand</span>,
179
+ <span class="ruby-value str">'t'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:untabify</span>, <span class="ruby-comment cmt"># obsolete</span>
180
+ <span class="ruby-value str">'S'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:intern</span>,
181
+ <span class="ruby-value str">'b'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:bodyonly</span>,
182
+ <span class="ruby-value str">'B'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:binding</span>,
183
+ <span class="ruby-value str">'p'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:pattern</span>,
184
+ <span class="ruby-value str">'c'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:context</span>,
185
+ <span class="ruby-comment cmt">#'C' =&gt; :class,</span>
186
+ <span class="ruby-value str">'e'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:escape</span>,
187
+ <span class="ruby-value str">'r'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:requires</span>,
188
+ <span class="ruby-value str">'f'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:datafiles</span>,
189
+ <span class="ruby-value str">'K'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:kanji</span>,
190
+ <span class="ruby-value str">'I'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:includes</span>,
191
+ <span class="ruby-value str">'l'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:lang</span>,
192
+ <span class="ruby-value str">'a'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:action</span>,
193
+ <span class="ruby-value str">'E'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:enhancers</span>,
194
+ <span class="ruby-value str">'X'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:notext</span>,
195
+ <span class="ruby-value str">'N'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:linenum</span>,
196
+ <span class="ruby-value str">'U'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:unique</span>,
197
+ <span class="ruby-value str">'C'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:compact</span>,
198
198
  }
199
199
  <span class="ruby-identifier">assert</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@single_options</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@arg_options</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@option_names</span>.<span class="ruby-identifier">length</span>
200
200
  (<span class="ruby-ivar">@single_options</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@arg_options</span>).<span class="ruby-identifier">each_byte</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ch</span><span class="ruby-operator">|</span>
201
- <span class="ruby-identifier">assert</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@option_names</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">ch</span>)
201
+ <span class="ruby-identifier">assert</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@option_names</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">ch</span>.<span class="ruby-identifier">chr</span>)
202
202
  <span class="ruby-keyword kw">end</span>
203
203
  <span class="ruby-keyword kw">end</span>
204
204
  </pre>
@@ -227,7 +227,7 @@ ex.
227
227
  <span class="ruby-comment cmt">## parse command-line options</span>
228
228
  <span class="ruby-identifier">options</span>, <span class="ruby-identifier">properties</span> = <span class="ruby-identifier">parse_argv</span>(<span class="ruby-identifier">argv</span>, <span class="ruby-ivar">@single_options</span>, <span class="ruby-ivar">@arg_options</span>)
229
229
  <span class="ruby-identifier">filenames</span> = <span class="ruby-identifier">argv</span>
230
- <span class="ruby-identifier">options</span>[<span class="ruby-value">?h</span>] = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:help</span>]
230
+ <span class="ruby-identifier">options</span>[<span class="ruby-value str">'h'</span>] = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:help</span>]
231
231
  <span class="ruby-identifier">opts</span> = <span class="ruby-constant">Object</span>.<span class="ruby-identifier">new</span>
232
232
  <span class="ruby-identifier">arr</span> = <span class="ruby-ivar">@option_names</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">ch</span>, <span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-node">&quot;def #{name}; @#{name}; end\n&quot;</span> }
233
233
  <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">instance_eval</span> <span class="ruby-identifier">arr</span>.<span class="ruby-identifier">join</span>
@@ -151,7 +151,7 @@ this class converts &#8217;&lt;?rb &#8230; ?&gt;&#8217; and
151
151
  onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
152
152
  <div class="method-source-code" id="M000045-source">
153
153
  <pre>
154
- <span class="ruby-comment cmt"># File erubis/converter.rb, line 224</span>
154
+ <span class="ruby-comment cmt"># File erubis/converter.rb, line 225</span>
155
155
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">input</span>)
156
156
  <span class="ruby-identifier">code</span> = <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">input</span>)
157
157
  <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@header</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@footer</span> <span class="ruby-operator">?</span> <span class="ruby-node">&quot;#{@header}#{code}#{@footer}&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">code</span>
@@ -175,7 +175,7 @@ this class converts &#8217;&lt;?rb &#8230; ?&gt;&#8217; and
175
175
  onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
176
176
  <div class="method-source-code" id="M000044-source">
177
177
  <pre>
178
- <span class="ruby-comment cmt"># File erubis/converter.rb, line 215</span>
178
+ <span class="ruby-comment cmt"># File erubis/converter.rb, line 216</span>
179
179
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init_converter</span>(<span class="ruby-identifier">properties</span>={})
180
180
  <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">properties</span>)
181
181
  <span class="ruby-ivar">@trim</span> = <span class="ruby-identifier">properties</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">:trim</span>, <span class="ruby-keyword kw">true</span>)
@@ -205,7 +205,7 @@ this class converts &#8217;&lt;?rb &#8230; ?&gt;&#8217; and
205
205
  onclick="toggleCode('M000046-source');return false;">[Source]</a></p>
206
206
  <div class="method-source-code" id="M000046-source">
207
207
  <pre>
208
- <span class="ruby-comment cmt"># File erubis/converter.rb, line 231</span>
208
+ <span class="ruby-comment cmt"># File erubis/converter.rb, line 232</span>
209
209
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert_input</span>(<span class="ruby-identifier">codebuf</span>, <span class="ruby-identifier">input</span>)
210
210
  <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@regexp</span>
211
211
  <span class="ruby-ivar">@pi</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">'e'</span>
@@ -242,7 +242,8 @@ this class converts &#8217;&lt;?rb &#8230; ?&gt;&#8217; and
242
242
  <span class="ruby-identifier">add_pi_expr</span>(<span class="ruby-identifier">codebuf</span>, <span class="ruby-identifier">expr1</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">expr2</span>, <span class="ruby-identifier">indicator1</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">indicator2</span>)
243
243
  <span class="ruby-keyword kw">end</span>
244
244
  <span class="ruby-keyword kw">end</span>
245
- <span class="ruby-identifier">rest</span> = <span class="ruby-identifier">$'</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">input</span>
245
+ <span class="ruby-comment cmt">#rest = $' || input # ruby1.8</span>
246
+ <span class="ruby-identifier">rest</span> = <span class="ruby-identifier">pos</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">input</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">input</span>[<span class="ruby-identifier">pos</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-comment cmt"># ruby1.9</span>
246
247
  <span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">codebuf</span>, <span class="ruby-identifier">rest</span>)
247
248
  <span class="ruby-keyword kw">end</span>
248
249
  </pre>
@@ -151,7 +151,7 @@
151
151
  onclick="toggleCode('M000050-source');return false;">[Source]</a></p>
152
152
  <div class="method-source-code" id="M000050-source">
153
153
  <pre>
154
- <span class="ruby-comment cmt"># File erubis/tiny.rb, line 80</span>
154
+ <span class="ruby-comment cmt"># File erubis/tiny.rb, line 81</span>
155
155
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">input</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">options</span>={})
156
156
  <span class="ruby-ivar">@escape</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:escape</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'Erubis::XmlHelper.escape_xml'</span>
157
157
  <span class="ruby-ivar">@src</span> = <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">input</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">input</span>
@@ -177,7 +177,7 @@
177
177
  onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
178
178
  <div class="method-source-code" id="M000051-source">
179
179
  <pre>
180
- <span class="ruby-comment cmt"># File erubis/tiny.rb, line 89</span>
180
+ <span class="ruby-comment cmt"># File erubis/tiny.rb, line 90</span>
181
181
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">input</span>)
182
182
  <span class="ruby-identifier">src</span> = <span class="ruby-value str">&quot;_buf = '';&quot;</span> <span class="ruby-comment cmt"># preamble</span>
183
183
  <span class="ruby-identifier">pos</span> = <span class="ruby-value">0</span>
@@ -205,7 +205,8 @@
205
205
  <span class="ruby-keyword kw">end</span>
206
206
  <span class="ruby-keyword kw">end</span>
207
207
  <span class="ruby-keyword kw">end</span>
208
- <span class="ruby-identifier">rest</span> = <span class="ruby-identifier">$'</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">input</span>
208
+ <span class="ruby-comment cmt">#rest = $' || input # ruby1.8</span>
209
+ <span class="ruby-identifier">rest</span> = <span class="ruby-identifier">pos</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">input</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">input</span>[<span class="ruby-identifier">pos</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-comment cmt"># ruby1.9</span>
209
210
  <span class="ruby-comment cmt">#src &lt;&lt; &quot; _buf &lt;&lt; '&quot; &lt;&lt; escape_text(rest) &lt;&lt; &quot;';&quot;</span>
210
211
  <span class="ruby-identifier">rest</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/['\\]/</span>, <span class="ruby-value str">'\\\\\&amp;'</span>)
211
212
  <span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; _buf &lt;&lt; '&quot;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">rest</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;';&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">rest</span>.<span class="ruby-identifier">empty?</span>
@@ -231,7 +232,7 @@
231
232
  onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
232
233
  <div class="method-source-code" id="M000053-source">
233
234
  <pre>
234
- <span class="ruby-comment cmt"># File erubis/tiny.rb, line 132</span>
235
+ <span class="ruby-comment cmt"># File erubis/tiny.rb, line 134</span>
235
236
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">evaluate</span>(<span class="ruby-identifier">_context</span>=<span class="ruby-constant">Object</span>.<span class="ruby-identifier">new</span>)
236
237
  <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">_context</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
237
238
  <span class="ruby-identifier">_obj</span> = <span class="ruby-constant">Object</span>.<span class="ruby-identifier">new</span>
@@ -268,7 +269,7 @@ end
268
269
  onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
269
270
  <div class="method-source-code" id="M000052-source">
270
271
  <pre>
271
- <span class="ruby-comment cmt"># File erubis/tiny.rb, line 128</span>
272
+ <span class="ruby-comment cmt"># File erubis/tiny.rb, line 130</span>
272
273
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">result</span>(<span class="ruby-identifier">_binding</span>=<span class="ruby-constant">TOPLEVEL_BINDING</span>)
273
274
  <span class="ruby-identifier">eval</span> <span class="ruby-ivar">@src</span>, <span class="ruby-identifier">_binding</span>
274
275
  <span class="ruby-keyword kw">end</span>
@@ -128,7 +128,7 @@ this is language-independent.
128
128
  onclick="toggleCode('M000188-source');return false;">[Source]</a></p>
129
129
  <div class="method-source-code" id="M000188-source">
130
130
  <pre>
131
- <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 446</span>
131
+ <span class="ruby-comment cmt"># File erubis/enhancer.rb, line 450</span>
132
132
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">text</span>)
133
133
  <span class="ruby-identifier">pos</span> = <span class="ruby-value">0</span>
134
134
  <span class="ruby-identifier">text2</span> = <span class="ruby-value str">''</span>
@@ -151,7 +151,8 @@ this is language-independent.
151
151
  <span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">line</span>)
152
152
  <span class="ruby-keyword kw">end</span>
153
153
  <span class="ruby-keyword kw">end</span>
154
- <span class="ruby-identifier">rest</span> = <span class="ruby-identifier">pos</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">text</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">$'</span> <span class="ruby-comment cmt"># or $' || text</span>
154
+ <span class="ruby-comment cmt">#rest = pos == 0 ? text : $' # ruby1.8</span>
155
+ <span class="ruby-identifier">rest</span> = <span class="ruby-identifier">pos</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">text</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">text</span>[<span class="ruby-identifier">pos</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-comment cmt"># ruby1.9</span>
155
156
  <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">text2</span>.<span class="ruby-identifier">empty?</span>
156
157
  <span class="ruby-identifier">text2</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">rest</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rest</span>
157
158
  <span class="ruby-identifier">rest</span> = <span class="ruby-identifier">text2</span>
@@ -135,7 +135,7 @@ define singleton method to it.
135
135
  onclick="toggleCode('M000197-source');return false;">[Source]</a></p>
136
136
  <div class="method-source-code" id="M000197-source">
137
137
  <pre>
138
- <span class="ruby-comment cmt"># File erubis/evaluator.rb, line 75</span>
138
+ <span class="ruby-comment cmt"># File erubis/evaluator.rb, line 80</span>
139
139
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">def_method</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">filename</span>=<span class="ruby-keyword kw">nil</span>)
140
140
  <span class="ruby-identifier">m</span> = <span class="ruby-identifier">object</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Module</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">:module_eval</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">:instance_eval</span>
141
141
  <span class="ruby-identifier">object</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">m</span>, <span class="ruby-node">&quot;def #{method_name}; #{@src}; end&quot;</span>, <span class="ruby-identifier">filename</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@filename</span> <span class="ruby-operator">||</span> <span class="ruby-value str">'(erubis)'</span>)
@@ -150,7 +150,7 @@ define singleton method to it.
150
150
 
151
151
  <div class="method-heading">
152
152
  <a href="#M000196" class="method-signature">
153
- <span class="method-name">evaluate</span><span class="method-args">(context=Context.new)</span>
153
+ <span class="method-name">evaluate</span><span class="method-args">(_context=Context.new)</span>
154
154
  </a>
155
155
  </div>
156
156
 
@@ -162,12 +162,13 @@ invoke context.instance_eval(@src)
162
162
  onclick="toggleCode('M000196-source');return false;">[Source]</a></p>
163
163
  <div class="method-source-code" id="M000196-source">
164
164
  <pre>
165
- <span class="ruby-comment cmt"># File erubis/evaluator.rb, line 66</span>
166
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">evaluate</span>(<span class="ruby-identifier">context</span>=<span class="ruby-constant">Context</span>.<span class="ruby-identifier">new</span>)
167
- <span class="ruby-identifier">context</span> = <span class="ruby-constant">Context</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">context</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">context</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
168
- <span class="ruby-comment cmt">#return context.instance_eval(@src, @filename || '(erubis)')</span>
169
- <span class="ruby-ivar">@_proc</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">eval</span>(<span class="ruby-node">&quot;proc { #{@src} }&quot;</span>, <span class="ruby-constant">Erubis</span><span class="ruby-operator">::</span><span class="ruby-constant">EMPTY_BINDING</span>, <span class="ruby-ivar">@filename</span> <span class="ruby-operator">||</span> <span class="ruby-value str">'(erubis)'</span>)
170
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">context</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&amp;</span><span class="ruby-ivar">@_proc</span>)
165
+ <span class="ruby-comment cmt"># File erubis/evaluator.rb, line 70</span>
166
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">evaluate</span>(<span class="ruby-identifier">_context</span>=<span class="ruby-constant">Context</span>.<span class="ruby-identifier">new</span>)
167
+ <span class="ruby-identifier">_context</span> = <span class="ruby-constant">Context</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">_context</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">_context</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
168
+ <span class="ruby-comment cmt">#return _context.instance_eval(@src, @filename || '(erubis)')</span>
169
+ <span class="ruby-comment cmt">#@_proc ||= eval(&quot;proc { #{@src} }&quot;, Erubis::EMPTY_BINDING, @filename || '(erubis)')</span>
170
+ <span class="ruby-ivar">@_proc</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">eval</span>(<span class="ruby-node">&quot;proc { #{@src} }&quot;</span>, <span class="ruby-identifier">binding</span>(), <span class="ruby-ivar">@filename</span> <span class="ruby-operator">||</span> <span class="ruby-value str">'(erubis)'</span>)
171
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">_context</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&amp;</span><span class="ruby-ivar">@_proc</span>)
171
172
  <span class="ruby-keyword kw">end</span>
172
173
  </pre>
173
174
  </div>
@@ -195,12 +196,16 @@ eval(@src) with binding object
195
196
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">result</span>(<span class="ruby-identifier">_binding_or_hash</span>=<span class="ruby-constant">TOPLEVEL_BINDING</span>)
196
197
  <span class="ruby-identifier">_arg</span> = <span class="ruby-identifier">_binding_or_hash</span>
197
198
  <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">_arg</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
198
- <span class="ruby-comment cmt">## load _context data as local variables by eval</span>
199
- <span class="ruby-comment cmt">#eval _arg.keys.inject(&quot;&quot;) { |s, k| s &lt;&lt; &quot;#{k.to_s} = _arg[#{k.inspect}];&quot; }</span>
200
- <span class="ruby-identifier">eval</span> <span class="ruby-identifier">_arg</span>.<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-node">&quot;#{k} = _arg[#{k.inspect}]; &quot;</span>}.<span class="ruby-identifier">join</span>
201
- <span class="ruby-identifier">_arg</span> = <span class="ruby-identifier">binding</span>()
199
+ <span class="ruby-identifier">_b</span> = <span class="ruby-identifier">binding</span>()
200
+ <span class="ruby-identifier">eval</span> <span class="ruby-identifier">_arg</span>.<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-node">&quot;#{k} = _arg[#{k.inspect}]; &quot;</span>}.<span class="ruby-identifier">join</span>, <span class="ruby-identifier">_b</span>
201
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">_arg</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Binding</span>)
202
+ <span class="ruby-identifier">_b</span> = <span class="ruby-identifier">_arg</span>
203
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">_arg</span>.<span class="ruby-identifier">nil?</span>
204
+ <span class="ruby-identifier">_b</span> = <span class="ruby-identifier">binding</span>()
205
+ <span class="ruby-keyword kw">else</span>
206
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{self.class.name}#result(): argument should be Binding or Hash but passed #{_arg.class.name} object.&quot;</span>)
202
207
  <span class="ruby-keyword kw">end</span>
203
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">eval</span>(<span class="ruby-ivar">@src</span>, <span class="ruby-identifier">_arg</span>, (<span class="ruby-ivar">@filename</span> <span class="ruby-operator">||</span> <span class="ruby-value str">'(erubis)'</span>))
208
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">eval</span>(<span class="ruby-ivar">@src</span>, <span class="ruby-identifier">_b</span>, (<span class="ruby-ivar">@filename</span> <span class="ruby-operator">||</span> <span class="ruby-value str">'(erubis'</span>))
204
209
  <span class="ruby-keyword kw">end</span>
205
210
  </pre>
206
211
  </div>