erubis 2.6.1 → 2.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +16 -2
- data/README.txt +2 -1
- data/benchmark/bench.rb +1 -1
- data/bin/erubis +1 -1
- data/contrib/erubis +1 -1
- data/contrib/inline-require +1 -1
- data/doc-api/classes/Erubis.html +1 -1
- data/doc-api/classes/Erubis/Basic/Converter.html +3 -2
- data/doc-api/classes/Erubis/BiPatternEnhancer.html +6 -3
- data/doc-api/classes/Erubis/DeleteIndentEnhancer.html +1 -1
- data/doc-api/classes/Erubis/HeaderFooterEnhancer.html +6 -3
- data/doc-api/classes/Erubis/InterpolationEnhancer.html +7 -6
- data/doc-api/classes/Erubis/Main.html +26 -26
- data/doc-api/classes/Erubis/PI/Converter.html +5 -4
- data/doc-api/classes/Erubis/PI/TinyEruby.html +6 -5
- data/doc-api/classes/Erubis/PercentLineEnhancer.html +3 -2
- data/doc-api/classes/Erubis/RubyEvaluator.html +18 -13
- data/doc-api/classes/Erubis/SimplifyEnhancer.html +2 -1
- data/doc-api/classes/Erubis/TinyEruby.html +4 -3
- data/doc-api/created.rid +1 -1
- data/doc-api/files/README_txt.html +4 -3
- data/doc-api/files/erubis/context_rb.html +1 -1
- data/doc-api/files/erubis/converter_rb.html +2 -2
- data/doc-api/files/erubis/engine/ec_rb.html +1 -1
- data/doc-api/files/erubis/engine/ejava_rb.html +1 -1
- data/doc-api/files/erubis/engine/ejavascript_rb.html +1 -1
- data/doc-api/files/erubis/engine/enhanced_rb.html +1 -1
- data/doc-api/files/erubis/engine/eperl_rb.html +1 -1
- data/doc-api/files/erubis/engine/ephp_rb.html +1 -1
- data/doc-api/files/erubis/engine/eruby_rb.html +1 -1
- data/doc-api/files/erubis/engine/escheme_rb.html +1 -1
- data/doc-api/files/erubis/engine/optimized_rb.html +1 -1
- data/doc-api/files/erubis/engine_rb.html +1 -1
- data/doc-api/files/erubis/enhancer_rb.html +2 -2
- data/doc-api/files/erubis/error_rb.html +1 -1
- data/doc-api/files/erubis/evaluator_rb.html +2 -2
- data/doc-api/files/erubis/generator_rb.html +1 -1
- data/doc-api/files/erubis/helper_rb.html +1 -1
- data/doc-api/files/erubis/helpers/rails_form_helper_rb.html +1 -1
- data/doc-api/files/erubis/helpers/rails_helper_rb.html +1 -1
- data/doc-api/files/erubis/local-setting_rb.html +1 -1
- data/doc-api/files/erubis/main_rb.html +2 -2
- data/doc-api/files/erubis/preprocessing_rb.html +1 -1
- data/doc-api/files/erubis/tiny_rb.html +2 -2
- data/doc-api/files/erubis_rb.html +1 -1
- data/doc/users-guide.html +13 -11
- data/lib/erubis.rb +2 -2
- data/lib/erubis/context.rb +1 -1
- data/lib/erubis/converter.rb +6 -4
- data/lib/erubis/engine.rb +1 -1
- data/lib/erubis/engine/ec.rb +1 -1
- data/lib/erubis/engine/ejava.rb +1 -1
- data/lib/erubis/engine/ejavascript.rb +1 -1
- data/lib/erubis/engine/enhanced.rb +1 -1
- data/lib/erubis/engine/eperl.rb +1 -1
- data/lib/erubis/engine/ephp.rb +1 -1
- data/lib/erubis/engine/eruby.rb +1 -1
- data/lib/erubis/engine/escheme.rb +1 -1
- data/lib/erubis/engine/optimized.rb +1 -1
- data/lib/erubis/enhancer.rb +16 -7
- data/lib/erubis/error.rb +1 -1
- data/lib/erubis/evaluator.rb +17 -12
- data/lib/erubis/generator.rb +1 -1
- data/lib/erubis/helper.rb +1 -1
- data/lib/erubis/helpers/rails_form_helper.rb +1 -1
- data/lib/erubis/helpers/rails_helper.rb +1 -1
- data/lib/erubis/local-setting.rb +1 -1
- data/lib/erubis/main.rb +32 -31
- data/lib/erubis/preprocessing.rb +1 -1
- data/lib/erubis/tiny.rb +6 -4
- data/test/assert-text-equal.rb +1 -1
- data/test/assert-text-equal.rbc +0 -0
- data/test/data/users-guide/example1.rb +1 -0
- data/test/data/users-guide/main_program2.result +1 -1
- data/test/hoge.rb +5 -0
- data/test/test-engines.rb +5 -2
- data/test/test-engines.rbc +0 -0
- data/test/test-enhancers.rb +4 -2
- data/test/test-erubis.rb +11 -5
- data/test/test-erubis.rbc +0 -0
- data/test/test-main.rb +27 -6
- data/test/test-users-guide.rb +4 -2
- data/test/test-users-guide.rbc +0 -0
- data/test/test.rb +1 -1
- data/test/test.rbc +0 -0
- data/test/testutil.rb +29 -3
- data/test/testutil.rbc +0 -0
- metadata +9 -4
- data/lib/erubis/converter.rb: +0 -0
- data/test/data/users-guide/stderr.log +0 -3
data/CHANGES.txt
CHANGED
@@ -1,7 +1,21 @@
|
|
1
|
-
#
|
2
|
-
# $
|
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.
|
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
|
|
data/benchmark/bench.rb
CHANGED
data/bin/erubis
CHANGED
data/contrib/erubis
CHANGED
data/contrib/inline-require
CHANGED
data/doc-api/classes/Erubis.html
CHANGED
@@ -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.
|
331
|
+
<td class="context-item-value">('$Release: 2.6.2 $' =~ /([.\d]+)/) && $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 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-
|
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
|
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
|
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-
|
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
|
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]+</</span>, <span class="ruby-value str">'<'</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
|
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">&&</span> <span class="ruby-identifier">lspace</span> <span class="ruby-operator">&&</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">"#{lspace}#{content}#{rspace}"</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">"@#{word}"</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">&&</span> <span class="ruby-identifier">rspace</span>
|
219
221
|
<span class="ruby-keyword kw">end</span>
|
220
|
-
<span class="ruby-
|
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
|
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">"#{@header}#{source}#{@footer}"</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
|
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">'\\\\\&'</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
|
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"><<</span> <span class="ruby-node">"\#{#{escaped_expr(code)}}"</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
|
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"><<</span> <span class="ruby-node">"\#{#{code}}"</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
|
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 << " _buf << %Q`" << text << "`;"</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
|
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">'<% %>'</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-
|
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">"hvxztTSbeBXNUC"</span>
|
172
172
|
<span class="ruby-ivar">@arg_options</span> = <span class="ruby-value str">"pcrfKIlaE"</span> <span class="ruby-comment cmt">#C</span>
|
173
173
|
<span class="ruby-ivar">@option_names</span> = {
|
174
|
-
<span class="ruby-value"
|
175
|
-
<span class="ruby-value"
|
176
|
-
<span class="ruby-value"
|
177
|
-
<span class="ruby-value"
|
178
|
-
<span class="ruby-value"
|
179
|
-
<span class="ruby-value"
|
180
|
-
<span class="ruby-value"
|
181
|
-
<span class="ruby-value"
|
182
|
-
<span class="ruby-value"
|
183
|
-
<span class="ruby-value"
|
184
|
-
<span class="ruby-value"
|
185
|
-
<span class="ruby-comment cmt"
|
186
|
-
<span class="ruby-value"
|
187
|
-
<span class="ruby-value"
|
188
|
-
<span class="ruby-value"
|
189
|
-
<span class="ruby-value"
|
190
|
-
<span class="ruby-value"
|
191
|
-
<span class="ruby-value"
|
192
|
-
<span class="ruby-value"
|
193
|
-
<span class="ruby-value"
|
194
|
-
<span class="ruby-value"
|
195
|
-
<span class="ruby-value"
|
196
|
-
<span class="ruby-value"
|
197
|
-
<span class="ruby-value"
|
174
|
+
<span class="ruby-value str">'h'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:help</span>,
|
175
|
+
<span class="ruby-value str">'v'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:version</span>,
|
176
|
+
<span class="ruby-value str">'x'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:source</span>,
|
177
|
+
<span class="ruby-value str">'z'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:syntax</span>,
|
178
|
+
<span class="ruby-value str">'T'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:unexpand</span>,
|
179
|
+
<span class="ruby-value str">'t'</span> =<span class="ruby-operator">></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">></span> <span class="ruby-identifier">:intern</span>,
|
181
|
+
<span class="ruby-value str">'b'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:bodyonly</span>,
|
182
|
+
<span class="ruby-value str">'B'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:binding</span>,
|
183
|
+
<span class="ruby-value str">'p'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:pattern</span>,
|
184
|
+
<span class="ruby-value str">'c'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:context</span>,
|
185
|
+
<span class="ruby-comment cmt">#'C' => :class,</span>
|
186
|
+
<span class="ruby-value str">'e'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:escape</span>,
|
187
|
+
<span class="ruby-value str">'r'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:requires</span>,
|
188
|
+
<span class="ruby-value str">'f'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:datafiles</span>,
|
189
|
+
<span class="ruby-value str">'K'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:kanji</span>,
|
190
|
+
<span class="ruby-value str">'I'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:includes</span>,
|
191
|
+
<span class="ruby-value str">'l'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:lang</span>,
|
192
|
+
<span class="ruby-value str">'a'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:action</span>,
|
193
|
+
<span class="ruby-value str">'E'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:enhancers</span>,
|
194
|
+
<span class="ruby-value str">'X'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:notext</span>,
|
195
|
+
<span class="ruby-value str">'N'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:linenum</span>,
|
196
|
+
<span class="ruby-value str">'U'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:unique</span>,
|
197
|
+
<span class="ruby-value str">'C'</span> =<span class="ruby-operator">></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"
|
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">"def #{name}; @#{name}; end\n"</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 ’<?rb … ?>’ 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
|
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">"#{@header}#{code}#{@footer}"</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">code</span>
|
@@ -175,7 +175,7 @@ this class converts ’<?rb … ?>’ 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
|
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 ’<?rb … ?>’ 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
|
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 ’<?rb … ?>’ 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-
|
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
|
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
|
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">"_buf = '';"</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-
|
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 << " _buf << '" << escape_text(rest) << "';"</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">'\\\\\&'</span>)
|
211
212
|
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">" _buf << '"</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">rest</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"';"</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
|
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
|
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
|
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-
|
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"><<</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
|
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">"def #{method_name}; #{@src}; end"</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">(
|
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
|
166
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">evaluate</span>(<span class="ruby-identifier">
|
167
|
-
<span class="ruby-identifier">
|
168
|
-
<span class="ruby-comment cmt">#return
|
169
|
-
<span class="ruby-
|
170
|
-
<span class="ruby-
|
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("proc { #{@src} }", 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">"proc { #{@src} }"</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">&</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-
|
199
|
-
<span class="ruby-
|
200
|
-
|
201
|
-
<span class="ruby-identifier">
|
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">"#{k} = _arg[#{k.inspect}]; "</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">"#{self.class.name}#result(): argument should be Binding or Hash but passed #{_arg.class.name} object."</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">
|
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>
|