erubis 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{ChangeLog → CHANGES} +139 -6
- data/MIT-LICENSE +20 -0
- data/README.txt +20 -5
- data/benchmark/erubybench.rb +465 -229
- data/benchmark/erubybench.rhtml +39 -15
- data/benchmark/erubybench.yaml +126 -46
- data/bin/erubis +2 -2
- data/bin/notext +3 -3
- data/contrib/action_view_base_rb.patch +23 -0
- data/contrib/erubis +466 -308
- data/contrib/inline-require +2 -2
- data/doc-api/classes/ERB.html +101 -0
- data/doc-api/classes/Erubis.html +59 -6
- data/doc-api/classes/Erubis/ArrayEnhancer.html +12 -12
- data/doc-api/classes/Erubis/Basic/Converter.html +61 -57
- data/doc-api/classes/Erubis/BiPatternEnhancer.html +14 -14
- data/doc-api/classes/Erubis/CGenerator.html +60 -60
- data/doc-api/classes/Erubis/Context.html +125 -29
- data/doc-api/classes/Erubis/Converter.html +73 -22
- data/doc-api/classes/Erubis/Engine.html +55 -39
- data/doc-api/classes/Erubis/EscapeEnhancer.html +6 -6
- data/doc-api/classes/Erubis/Evaluator.html +19 -19
- data/doc-api/classes/Erubis/Generator.html +16 -10
- data/doc-api/classes/Erubis/HeaderFooterEnhancer.html +14 -14
- data/doc-api/classes/Erubis/{Helper.html → Helpers.html} +5 -6
- data/doc-api/classes/Erubis/Helpers/RailsHelper.html +296 -0
- data/doc-api/classes/Erubis/JavaGenerator.html +54 -54
- data/doc-api/classes/Erubis/JavascriptGenerator.html +60 -60
- data/doc-api/classes/Erubis/Main.html +42 -30
- data/doc-api/classes/Erubis/NoCodeEnhancer.html +5 -5
- data/doc-api/classes/Erubis/NoTextEnhancer.html +7 -7
- data/doc-api/classes/Erubis/OptimizedEruby.html +6 -6
- data/doc-api/classes/Erubis/OptimizedGenerator.html +72 -72
- data/doc-api/classes/Erubis/OptimizedXmlEruby.html +6 -6
- data/doc-api/classes/Erubis/PI/Converter.html +28 -81
- data/doc-api/classes/Erubis/PI/Ec.html +6 -6
- data/doc-api/classes/Erubis/PI/Ejava.html +6 -6
- data/doc-api/classes/Erubis/PI/Ejavascript.html +6 -6
- data/doc-api/classes/Erubis/PI/Eperl.html +6 -6
- data/doc-api/classes/Erubis/PI/Ephp.html +6 -6
- data/doc-api/classes/Erubis/PI/Eruby.html +7 -7
- data/doc-api/classes/Erubis/PI/Escheme.html +6 -6
- data/doc-api/classes/Erubis/PI/TinyEruby.html +66 -79
- data/doc-api/classes/Erubis/PercentLineEnhancer.html +8 -8
- data/doc-api/classes/Erubis/PerlGenerator.html +54 -54
- data/doc-api/classes/Erubis/PhpGenerator.html +54 -54
- data/doc-api/classes/Erubis/PrintEnabledEnhancer.html +21 -21
- data/doc-api/classes/Erubis/PrintOutEnhancer.html +30 -30
- data/doc-api/classes/Erubis/RubyEvaluator.html +12 -12
- data/doc-api/classes/Erubis/RubyGenerator.html +9 -9
- data/doc-api/classes/Erubis/SimplifyEnhancer.html +7 -6
- data/doc-api/classes/Erubis/StdoutEnhancer.html +12 -12
- data/doc-api/classes/Erubis/StringBufferEnhancer.html +13 -13
- data/doc-api/classes/Erubis/TinyEruby.html +56 -68
- data/doc-api/classes/Erubis/XmlHelper.html +20 -23
- data/doc-api/created.rid +1 -1
- data/doc-api/files/{__/README_txt.html → README_txt.html} +35 -20
- data/doc-api/files/erubis/context_rb.html +2 -2
- data/doc-api/files/erubis/converter_rb.html +2 -2
- data/doc-api/files/erubis/engine/ec_rb.html +2 -2
- data/doc-api/files/erubis/engine/ejava_rb.html +2 -2
- data/doc-api/files/erubis/engine/ejavascript_rb.html +2 -2
- data/doc-api/files/erubis/engine/enhanced_rb.html +2 -2
- data/doc-api/files/erubis/engine/eperl_rb.html +2 -2
- data/doc-api/files/erubis/engine/ephp_rb.html +2 -2
- data/doc-api/files/erubis/engine/eruby_rb.html +2 -3
- data/doc-api/files/erubis/engine/escheme_rb.html +2 -2
- data/doc-api/files/erubis/engine/optimized_rb.html +2 -2
- data/doc-api/files/erubis/engine_rb.html +2 -2
- data/doc-api/files/erubis/enhancer_rb.html +2 -2
- data/doc-api/files/erubis/error_rb.html +2 -2
- data/doc-api/files/erubis/evaluator_rb.html +2 -2
- data/doc-api/files/erubis/generator_rb.html +2 -2
- data/doc-api/files/erubis/helper_rb.html +2 -2
- data/doc-api/files/erubis/{helper/rails_rb.html → helpers/rails_helper_rb.html} +6 -31
- data/doc-api/files/erubis/local-setting_rb.html +2 -2
- data/doc-api/files/erubis/main_rb.html +4 -2
- data/doc-api/files/erubis/tiny_rb.html +2 -2
- data/doc-api/files/erubis_rb.html +2 -2
- data/doc-api/fr_class_index.html +3 -3
- data/doc-api/fr_file_index.html +2 -2
- data/doc-api/fr_method_index.html +142 -147
- data/doc-api/index.html +1 -1
- data/doc/users-guide.html +387 -218
- data/lib/erubis.rb +21 -25
- data/lib/erubis/context.rb +34 -4
- data/lib/erubis/converter.rb +159 -115
- data/lib/erubis/engine.rb +29 -12
- data/lib/erubis/engine/ec.rb +2 -2
- data/lib/erubis/engine/ejava.rb +2 -2
- data/lib/erubis/engine/ejavascript.rb +2 -2
- data/lib/erubis/engine/enhanced.rb +2 -2
- data/lib/erubis/engine/eperl.rb +2 -2
- data/lib/erubis/engine/ephp.rb +2 -2
- data/lib/erubis/engine/eruby.rb +5 -6
- data/lib/erubis/engine/escheme.rb +2 -2
- data/lib/erubis/engine/optimized.rb +2 -2
- data/lib/erubis/enhancer.rb +33 -7
- data/lib/erubis/error.rb +2 -2
- data/lib/erubis/evaluator.rb +2 -2
- data/lib/erubis/generator.rb +6 -3
- data/lib/erubis/helper.rb +6 -23
- data/lib/erubis/helpers/rails_helper.rb +202 -0
- data/lib/erubis/local-setting.rb +4 -4
- data/lib/erubis/main.rb +90 -35
- data/lib/erubis/tiny.rb +57 -52
- data/test/assert-text-equal.rb +2 -2
- data/test/test-engines.rb +5 -5
- data/test/test-erubis.rb +173 -63
- data/test/test-main.rb +135 -27
- data/test/test-notext.rb +2 -2
- data/test/test.rb +2 -2
- data/test/testutil.rb +2 -2
- metadata +16 -16
- data/LGPL +0 -504
- data/doc-api/classes/Erubis/Helper/CachedRailsTemplate.html +0 -198
- data/doc-api/classes/Erubis/Helper/RailsTemplate.html +0 -366
- data/lib/erubis/helper/rails.rb +0 -159
@@ -1,198 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Class: Erubis::Helper::CachedRailsTemplate</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Class</strong></td>
|
53
|
-
<td class="class-name-in-header">Erubis::Helper::CachedRailsTemplate</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../../files/erubis/helper/rails_rb.html">
|
59
|
-
erubis/helper/rails.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
<tr class="top-aligned-row">
|
66
|
-
<td><strong>Parent:</strong></td>
|
67
|
-
<td>
|
68
|
-
<a href="RailsTemplate.html">
|
69
|
-
RailsTemplate
|
70
|
-
</a>
|
71
|
-
</td>
|
72
|
-
</tr>
|
73
|
-
</table>
|
74
|
-
</div>
|
75
|
-
<!-- banner header -->
|
76
|
-
|
77
|
-
<div id="bodyContent">
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
<div id="contextContent">
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
</div>
|
86
|
-
|
87
|
-
<div id="method-list">
|
88
|
-
<h3 class="section-bar">Methods</h3>
|
89
|
-
|
90
|
-
<div class="name-list">
|
91
|
-
<a href="#M000142">_evaluate_proc</a>
|
92
|
-
<a href="#M000141">render</a>
|
93
|
-
</div>
|
94
|
-
</div>
|
95
|
-
|
96
|
-
</div>
|
97
|
-
|
98
|
-
|
99
|
-
<!-- if includes -->
|
100
|
-
|
101
|
-
<div id="section">
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
<!-- if method_list -->
|
111
|
-
<div id="methods">
|
112
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
113
|
-
|
114
|
-
<div id="method-M000141" class="method-detail">
|
115
|
-
<a name="M000141"></a>
|
116
|
-
|
117
|
-
<div class="method-heading">
|
118
|
-
<a href="#M000141" class="method-signature">
|
119
|
-
<span class="method-name">render</span><span class="method-args">(template, assigns)</span>
|
120
|
-
</a>
|
121
|
-
</div>
|
122
|
-
|
123
|
-
<div class="method-description">
|
124
|
-
<p><a class="source-toggle" href="#"
|
125
|
-
onclick="toggleCode('M000141-source');return false;">[Source]</a></p>
|
126
|
-
<div class="method-source-code" id="M000141-source">
|
127
|
-
<pre>
|
128
|
-
<span class="ruby-comment cmt"># File erubis/helper/rails.rb, line 118</span>
|
129
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span>(<span class="ruby-identifier">template</span>, <span class="ruby-identifier">assigns</span>)
|
130
|
-
<span class="ruby-comment cmt">## template path without suffix</span>
|
131
|
-
<span class="ruby-comment cmt">## (how to get template path name with suffix? I can't find...)</span>
|
132
|
-
<span class="ruby-identifier">c</span> = <span class="ruby-ivar">@view</span>.<span class="ruby-identifier">controller</span>
|
133
|
-
<span class="ruby-identifier">template_basename</span> = <span class="ruby-identifier">c</span>.<span class="ruby-identifier">template_root</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"/"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">controller_name</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"/"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">action_name</span>
|
134
|
-
|
135
|
-
<span class="ruby-comment cmt">## cache template</span>
|
136
|
-
<span class="ruby-identifier">proc_obj</span> = <span class="ruby-ivar">@@cache_table</span>[<span class="ruby-identifier">template_basename</span>]
|
137
|
-
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">proc_obj</span>
|
138
|
-
<span class="ruby-identifier">code</span> = <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">template</span>)
|
139
|
-
<span class="ruby-identifier">proc_obj</span> = <span class="ruby-identifier">eval</span>(<span class="ruby-node">"proc do #{code} end"</span>)
|
140
|
-
<span class="ruby-ivar">@@cache_table</span>[<span class="ruby-identifier">template_basename</span>] = <span class="ruby-identifier">proc_obj</span>
|
141
|
-
<span class="ruby-keyword kw">end</span>
|
142
|
-
|
143
|
-
<span class="ruby-comment cmt">## use @view as context object</span>
|
144
|
-
<span class="ruby-ivar">@view</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">:evaluate_assigns</span>)
|
145
|
-
<span class="ruby-comment cmt">#or @view.instance_eval("evaluate_assigns()")</span>
|
146
|
-
<span class="ruby-identifier">context</span> = <span class="ruby-ivar">@view</span>
|
147
|
-
|
148
|
-
<span class="ruby-comment cmt">## evaluate ruby code with context object</span>
|
149
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">assigns</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">assigns</span>.<span class="ruby-identifier">empty?</span>
|
150
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">_evaluate_proc</span>(<span class="ruby-identifier">proc_obj</span>, <span class="ruby-identifier">context</span>, <span class="ruby-identifier">assigns</span>)
|
151
|
-
<span class="ruby-keyword kw">else</span>
|
152
|
-
<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-identifier">proc_obj</span>)
|
153
|
-
<span class="ruby-keyword kw">end</span>
|
154
|
-
<span class="ruby-keyword kw">end</span>
|
155
|
-
</pre>
|
156
|
-
</div>
|
157
|
-
</div>
|
158
|
-
</div>
|
159
|
-
|
160
|
-
<h3 class="section-bar">Protected Instance methods</h3>
|
161
|
-
|
162
|
-
<div id="method-M000142" class="method-detail">
|
163
|
-
<a name="M000142"></a>
|
164
|
-
|
165
|
-
<div class="method-heading">
|
166
|
-
<a href="#M000142" class="method-signature">
|
167
|
-
<span class="method-name">_evaluate_proc</span><span class="method-args">(_proc_obj, _context, _localvars)</span>
|
168
|
-
</a>
|
169
|
-
</div>
|
170
|
-
|
171
|
-
<div class="method-description">
|
172
|
-
<p><a class="source-toggle" href="#"
|
173
|
-
onclick="toggleCode('M000142-source');return false;">[Source]</a></p>
|
174
|
-
<div class="method-source-code" id="M000142-source">
|
175
|
-
<pre>
|
176
|
-
<span class="ruby-comment cmt"># File erubis/helper/rails.rb, line 149</span>
|
177
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_evaluate_proc</span>(<span class="ruby-identifier">_proc_obj</span>, <span class="ruby-identifier">_context</span>, <span class="ruby-identifier">_localvars</span>)
|
178
|
-
<span class="ruby-identifier">eval</span>(<span class="ruby-identifier">_localvar_code</span>(<span class="ruby-identifier">_localvars</span>))
|
179
|
-
<span class="ruby-identifier">_context</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">_proc_obj</span>)
|
180
|
-
<span class="ruby-keyword kw">end</span>
|
181
|
-
</pre>
|
182
|
-
</div>
|
183
|
-
</div>
|
184
|
-
</div>
|
185
|
-
|
186
|
-
|
187
|
-
</div>
|
188
|
-
|
189
|
-
|
190
|
-
</div>
|
191
|
-
|
192
|
-
|
193
|
-
<div id="validator-badges">
|
194
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
195
|
-
</div>
|
196
|
-
|
197
|
-
</body>
|
198
|
-
</html>
|
@@ -1,366 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Class: Erubis::Helper::RailsTemplate</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Class</strong></td>
|
53
|
-
<td class="class-name-in-header">Erubis::Helper::RailsTemplate</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../../files/erubis/helper/rails_rb.html">
|
59
|
-
erubis/helper/rails.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
<tr class="top-aligned-row">
|
66
|
-
<td><strong>Parent:</strong></td>
|
67
|
-
<td>
|
68
|
-
Object
|
69
|
-
</td>
|
70
|
-
</tr>
|
71
|
-
</table>
|
72
|
-
</div>
|
73
|
-
<!-- banner header -->
|
74
|
-
|
75
|
-
<div id="bodyContent">
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
<div id="contextContent">
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
</div>
|
84
|
-
|
85
|
-
<div id="method-list">
|
86
|
-
<h3 class="section-bar">Methods</h3>
|
87
|
-
|
88
|
-
<div class="name-list">
|
89
|
-
<a href="#M000151">_evaluate_string</a>
|
90
|
-
<a href="#M000150">_localvar_code</a>
|
91
|
-
<a href="#M000148">convert</a>
|
92
|
-
<a href="#M000145">default_properties</a>
|
93
|
-
<a href="#M000146">default_properties=</a>
|
94
|
-
<a href="#M000143">engine_class</a>
|
95
|
-
<a href="#M000144">engine_class=</a>
|
96
|
-
<a href="#M000147">new</a>
|
97
|
-
<a href="#M000149">render</a>
|
98
|
-
</div>
|
99
|
-
</div>
|
100
|
-
|
101
|
-
</div>
|
102
|
-
|
103
|
-
|
104
|
-
<!-- if includes -->
|
105
|
-
|
106
|
-
<div id="section">
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
<!-- if method_list -->
|
116
|
-
<div id="methods">
|
117
|
-
<h3 class="section-bar">Public Class methods</h3>
|
118
|
-
|
119
|
-
<div id="method-M000145" class="method-detail">
|
120
|
-
<a name="M000145"></a>
|
121
|
-
|
122
|
-
<div class="method-heading">
|
123
|
-
<a href="#M000145" class="method-signature">
|
124
|
-
<span class="method-name">default_properties</span><span class="method-args">()</span>
|
125
|
-
</a>
|
126
|
-
</div>
|
127
|
-
|
128
|
-
<div class="method-description">
|
129
|
-
<p><a class="source-toggle" href="#"
|
130
|
-
onclick="toggleCode('M000145-source');return false;">[Source]</a></p>
|
131
|
-
<div class="method-source-code" id="M000145-source">
|
132
|
-
<pre>
|
133
|
-
<span class="ruby-comment cmt"># File erubis/helper/rails.rb, line 49</span>
|
134
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_properties</span>
|
135
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@@default_properties</span>
|
136
|
-
<span class="ruby-keyword kw">end</span>
|
137
|
-
</pre>
|
138
|
-
</div>
|
139
|
-
</div>
|
140
|
-
</div>
|
141
|
-
|
142
|
-
<div id="method-M000146" class="method-detail">
|
143
|
-
<a name="M000146"></a>
|
144
|
-
|
145
|
-
<div class="method-heading">
|
146
|
-
<a href="#M000146" class="method-signature">
|
147
|
-
<span class="method-name">default_properties=</span><span class="method-args">(properties)</span>
|
148
|
-
</a>
|
149
|
-
</div>
|
150
|
-
|
151
|
-
<div class="method-description">
|
152
|
-
<p><a class="source-toggle" href="#"
|
153
|
-
onclick="toggleCode('M000146-source');return false;">[Source]</a></p>
|
154
|
-
<div class="method-source-code" id="M000146-source">
|
155
|
-
<pre>
|
156
|
-
<span class="ruby-comment cmt"># File erubis/helper/rails.rb, line 53</span>
|
157
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_properties=</span>(<span class="ruby-identifier">properties</span>)
|
158
|
-
<span class="ruby-ivar">@@default_properties</span> = <span class="ruby-identifier">properties</span>
|
159
|
-
<span class="ruby-keyword kw">end</span>
|
160
|
-
</pre>
|
161
|
-
</div>
|
162
|
-
</div>
|
163
|
-
</div>
|
164
|
-
|
165
|
-
<div id="method-M000143" class="method-detail">
|
166
|
-
<a name="M000143"></a>
|
167
|
-
|
168
|
-
<div class="method-heading">
|
169
|
-
<a href="#M000143" class="method-signature">
|
170
|
-
<span class="method-name">engine_class</span><span class="method-args">()</span>
|
171
|
-
</a>
|
172
|
-
</div>
|
173
|
-
|
174
|
-
<div class="method-description">
|
175
|
-
<p><a class="source-toggle" href="#"
|
176
|
-
onclick="toggleCode('M000143-source');return false;">[Source]</a></p>
|
177
|
-
<div class="method-source-code" id="M000143-source">
|
178
|
-
<pre>
|
179
|
-
<span class="ruby-comment cmt"># File erubis/helper/rails.rb, line 35</span>
|
180
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">engine_class</span>
|
181
|
-
<span class="ruby-ivar">@@engine_class</span>
|
182
|
-
<span class="ruby-keyword kw">end</span>
|
183
|
-
</pre>
|
184
|
-
</div>
|
185
|
-
</div>
|
186
|
-
</div>
|
187
|
-
|
188
|
-
<div id="method-M000144" class="method-detail">
|
189
|
-
<a name="M000144"></a>
|
190
|
-
|
191
|
-
<div class="method-heading">
|
192
|
-
<a href="#M000144" class="method-signature">
|
193
|
-
<span class="method-name">engine_class=</span><span class="method-args">(klass)</span>
|
194
|
-
</a>
|
195
|
-
</div>
|
196
|
-
|
197
|
-
<div class="method-description">
|
198
|
-
<p><a class="source-toggle" href="#"
|
199
|
-
onclick="toggleCode('M000144-source');return false;">[Source]</a></p>
|
200
|
-
<div class="method-source-code" id="M000144-source">
|
201
|
-
<pre>
|
202
|
-
<span class="ruby-comment cmt"># File erubis/helper/rails.rb, line 39</span>
|
203
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">engine_class=</span>(<span class="ruby-identifier">klass</span>)
|
204
|
-
<span class="ruby-ivar">@@engine_class</span> = <span class="ruby-identifier">klass</span>
|
205
|
-
<span class="ruby-ivar">@@engine_instance</span> = <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">new</span>
|
206
|
-
<span class="ruby-keyword kw">end</span>
|
207
|
-
</pre>
|
208
|
-
</div>
|
209
|
-
</div>
|
210
|
-
</div>
|
211
|
-
|
212
|
-
<div id="method-M000147" class="method-detail">
|
213
|
-
<a name="M000147"></a>
|
214
|
-
|
215
|
-
<div class="method-heading">
|
216
|
-
<a href="#M000147" class="method-signature">
|
217
|
-
<span class="method-name">new</span><span class="method-args">(view)</span>
|
218
|
-
</a>
|
219
|
-
</div>
|
220
|
-
|
221
|
-
<div class="method-description">
|
222
|
-
<p>
|
223
|
-
cattr_accessor :<a href="RailsTemplate.html#M000145">default_properties</a>
|
224
|
-
</p>
|
225
|
-
<p><a class="source-toggle" href="#"
|
226
|
-
onclick="toggleCode('M000147-source');return false;">[Source]</a></p>
|
227
|
-
<div class="method-source-code" id="M000147-source">
|
228
|
-
<pre>
|
229
|
-
<span class="ruby-comment cmt"># File erubis/helper/rails.rb, line 60</span>
|
230
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">view</span>)
|
231
|
-
<span class="ruby-ivar">@view</span> = <span class="ruby-identifier">view</span>
|
232
|
-
<span class="ruby-comment cmt">#@@engine_instance ||= @@engine_class.new(nil, @@default_properties)</span>
|
233
|
-
<span class="ruby-keyword kw">end</span>
|
234
|
-
</pre>
|
235
|
-
</div>
|
236
|
-
</div>
|
237
|
-
</div>
|
238
|
-
|
239
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
240
|
-
|
241
|
-
<div id="method-M000148" class="method-detail">
|
242
|
-
<a name="M000148"></a>
|
243
|
-
|
244
|
-
<div class="method-heading">
|
245
|
-
<a href="#M000148" class="method-signature">
|
246
|
-
<span class="method-name">convert</span><span class="method-args">(template)</span>
|
247
|
-
</a>
|
248
|
-
</div>
|
249
|
-
|
250
|
-
<div class="method-description">
|
251
|
-
<p><a class="source-toggle" href="#"
|
252
|
-
onclick="toggleCode('M000148-source');return false;">[Source]</a></p>
|
253
|
-
<div class="method-source-code" id="M000148-source">
|
254
|
-
<pre>
|
255
|
-
<span class="ruby-comment cmt"># File erubis/helper/rails.rb, line 66</span>
|
256
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">template</span>)
|
257
|
-
<span class="ruby-comment cmt">#code = @@engine_instance.convert(template)</span>
|
258
|
-
<span class="ruby-comment cmt">#return code</span>
|
259
|
-
<span class="ruby-identifier">engine</span> = <span class="ruby-ivar">@@engine_class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">nil</span>, <span class="ruby-ivar">@@default_properties</span>)
|
260
|
-
<span class="ruby-identifier">code</span> = <span class="ruby-identifier">engine</span>.<span class="ruby-identifier">convert</span>(<span class="ruby-identifier">template</span>)
|
261
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">code</span>
|
262
|
-
<span class="ruby-keyword kw">end</span>
|
263
|
-
</pre>
|
264
|
-
</div>
|
265
|
-
</div>
|
266
|
-
</div>
|
267
|
-
|
268
|
-
<div id="method-M000149" class="method-detail">
|
269
|
-
<a name="M000149"></a>
|
270
|
-
|
271
|
-
<div class="method-heading">
|
272
|
-
<a href="#M000149" class="method-signature">
|
273
|
-
<span class="method-name">render</span><span class="method-args">(template, assigns)</span>
|
274
|
-
</a>
|
275
|
-
</div>
|
276
|
-
|
277
|
-
<div class="method-description">
|
278
|
-
<p><a class="source-toggle" href="#"
|
279
|
-
onclick="toggleCode('M000149-source');return false;">[Source]</a></p>
|
280
|
-
<div class="method-source-code" id="M000149-source">
|
281
|
-
<pre>
|
282
|
-
<span class="ruby-comment cmt"># File erubis/helper/rails.rb, line 75</span>
|
283
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span>(<span class="ruby-identifier">template</span>, <span class="ruby-identifier">assigns</span>)
|
284
|
-
<span class="ruby-comment cmt">## get ruby code</span>
|
285
|
-
<span class="ruby-identifier">code</span> = <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">template</span>)
|
286
|
-
|
287
|
-
<span class="ruby-comment cmt">## use @view as context object</span>
|
288
|
-
<span class="ruby-ivar">@view</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">:evaluate_assigns</span>) <span class="ruby-comment cmt">#or @view.instance_eval("evaluate_assigns()")</span>
|
289
|
-
<span class="ruby-identifier">context</span> = <span class="ruby-ivar">@view</span>
|
290
|
-
|
291
|
-
<span class="ruby-comment cmt">## evaluate ruby code with context object</span>
|
292
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">assigns</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">assigns</span>.<span class="ruby-identifier">empty?</span>
|
293
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">_evaluate_string</span>(<span class="ruby-identifier">code</span>, <span class="ruby-identifier">context</span>, <span class="ruby-identifier">assigns</span>)
|
294
|
-
<span class="ruby-keyword kw">else</span>
|
295
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">context</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-identifier">code</span>)
|
296
|
-
<span class="ruby-keyword kw">end</span>
|
297
|
-
<span class="ruby-keyword kw">end</span>
|
298
|
-
</pre>
|
299
|
-
</div>
|
300
|
-
</div>
|
301
|
-
</div>
|
302
|
-
|
303
|
-
<h3 class="section-bar">Protected Instance methods</h3>
|
304
|
-
|
305
|
-
<div id="method-M000151" class="method-detail">
|
306
|
-
<a name="M000151"></a>
|
307
|
-
|
308
|
-
<div class="method-heading">
|
309
|
-
<a href="#M000151" class="method-signature">
|
310
|
-
<span class="method-name">_evaluate_string</span><span class="method-args">(_code, _context, _localvars)</span>
|
311
|
-
</a>
|
312
|
-
</div>
|
313
|
-
|
314
|
-
<div class="method-description">
|
315
|
-
<p><a class="source-toggle" href="#"
|
316
|
-
onclick="toggleCode('M000151-source');return false;">[Source]</a></p>
|
317
|
-
<div class="method-source-code" id="M000151-source">
|
318
|
-
<pre>
|
319
|
-
<span class="ruby-comment cmt"># File erubis/helper/rails.rb, line 102</span>
|
320
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_evaluate_string</span>(<span class="ruby-identifier">_code</span>, <span class="ruby-identifier">_context</span>, <span class="ruby-identifier">_localvars</span>)
|
321
|
-
<span class="ruby-identifier">eval</span>(<span class="ruby-identifier">_localvar_code</span>(<span class="ruby-identifier">_localvars</span>))
|
322
|
-
<span class="ruby-identifier">_context</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-identifier">_code</span>)
|
323
|
-
<span class="ruby-keyword kw">end</span>
|
324
|
-
</pre>
|
325
|
-
</div>
|
326
|
-
</div>
|
327
|
-
</div>
|
328
|
-
|
329
|
-
<div id="method-M000150" class="method-detail">
|
330
|
-
<a name="M000150"></a>
|
331
|
-
|
332
|
-
<div class="method-heading">
|
333
|
-
<a href="#M000150" class="method-signature">
|
334
|
-
<span class="method-name">_localvar_code</span><span class="method-args">(_localvars)</span>
|
335
|
-
</a>
|
336
|
-
</div>
|
337
|
-
|
338
|
-
<div class="method-description">
|
339
|
-
<p><a class="source-toggle" href="#"
|
340
|
-
onclick="toggleCode('M000150-source');return false;">[Source]</a></p>
|
341
|
-
<div class="method-source-code" id="M000150-source">
|
342
|
-
<pre>
|
343
|
-
<span class="ruby-comment cmt"># File erubis/helper/rails.rb, line 95</span>
|
344
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_localvar_code</span>(<span class="ruby-identifier">_localvars</span>)
|
345
|
-
<span class="ruby-identifier">list</span> = <span class="ruby-identifier">_localvars</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">_name</span><span class="ruby-operator">|</span> <span class="ruby-node">"#{_name} = _localvars[#{_name.inspect}]\n"</span> }
|
346
|
-
<span class="ruby-identifier">code</span> = <span class="ruby-identifier">list</span>.<span class="ruby-identifier">join</span>()
|
347
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">code</span>
|
348
|
-
<span class="ruby-keyword kw">end</span>
|
349
|
-
</pre>
|
350
|
-
</div>
|
351
|
-
</div>
|
352
|
-
</div>
|
353
|
-
|
354
|
-
|
355
|
-
</div>
|
356
|
-
|
357
|
-
|
358
|
-
</div>
|
359
|
-
|
360
|
-
|
361
|
-
<div id="validator-badges">
|
362
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
363
|
-
</div>
|
364
|
-
|
365
|
-
</body>
|
366
|
-
</html>
|