ember 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +15 -0
- data/bin/ember +47 -0
- data/doc/api/classes/Ember.html +61 -0
- data/doc/api/classes/Ember/Template.html +396 -0
- data/doc/api/classes/Ember/Template/Program.html +497 -0
- data/doc/api/created.rid +1 -0
- data/doc/api/css/main.css +263 -0
- data/doc/api/css/panel.css +383 -0
- data/doc/api/css/reset.css +53 -0
- data/doc/api/files/LICENSE.html +76 -0
- data/doc/api/files/lib/ember/template_rb.html +66 -0
- data/doc/api/files/lib/ember_rb.html +63 -0
- data/doc/api/i/arrows.png +0 -0
- data/doc/api/i/results_bg.png +0 -0
- data/doc/api/i/tree_bg.png +0 -0
- data/doc/api/index.html +14 -0
- data/doc/api/js/jquery-1.3.2.min.js +19 -0
- data/doc/api/js/jquery-effect.js +593 -0
- data/doc/api/js/main.js +22 -0
- data/doc/api/js/searchdoc.js +605 -0
- data/doc/api/panel/index.html +63 -0
- data/doc/api/panel/search_index.js +1 -0
- data/doc/api/panel/tree.js +1 -0
- data/doc/example.erb +2 -0
- data/doc/example.txt +2 -0
- data/doc/history.erb +9 -0
- data/doc/index.erb +11 -0
- data/doc/index.xhtml +758 -0
- data/doc/intro.erb +79 -0
- data/doc/setup.erb +29 -0
- data/doc/usage.erb +249 -0
- data/lib/ember.rb +16 -0
- data/lib/ember/template.rb +586 -0
- data/rakefile +14 -0
- data/test/ember.rb +17 -0
- data/test/ember/template.rb +141 -0
- metadata +109 -0
@@ -0,0 +1,497 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<title>Ember::Template::Program</title>
|
7
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
8
|
+
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
|
9
|
+
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
|
10
|
+
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
|
11
|
+
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
|
12
|
+
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
|
13
|
+
</head>
|
14
|
+
|
15
|
+
<body>
|
16
|
+
<div class="banner">
|
17
|
+
<h1>
|
18
|
+
<span class="type">Class</span>
|
19
|
+
Ember::Template::Program
|
20
|
+
|
21
|
+
<span class="parent"><
|
22
|
+
|
23
|
+
Object
|
24
|
+
|
25
|
+
</span>
|
26
|
+
|
27
|
+
</h1>
|
28
|
+
<ul class="files">
|
29
|
+
|
30
|
+
<li><a href="../../../files/lib/ember/template_rb.html">lib/ember/template.rb</a></li>
|
31
|
+
|
32
|
+
</ul>
|
33
|
+
</div>
|
34
|
+
<div id="bodyContent">
|
35
|
+
<div id="content">
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
<div class="sectiontitle">Methods</div>
|
46
|
+
<dl class="methods">
|
47
|
+
|
48
|
+
<dt>C</dt>
|
49
|
+
<dd>
|
50
|
+
<ul>
|
51
|
+
|
52
|
+
<li><a href="#M000018">code</a>,</li>
|
53
|
+
|
54
|
+
<li><a href="#M000021">compile</a></li>
|
55
|
+
|
56
|
+
</ul>
|
57
|
+
</dd>
|
58
|
+
|
59
|
+
<dt>E</dt>
|
60
|
+
<dd>
|
61
|
+
<ul>
|
62
|
+
|
63
|
+
<li><a href="#M000020">emit_end</a>,</li>
|
64
|
+
|
65
|
+
<li><a href="#M000014">empty?</a>,</li>
|
66
|
+
|
67
|
+
<li><a href="#M000019">expr</a></li>
|
68
|
+
|
69
|
+
</ul>
|
70
|
+
</dd>
|
71
|
+
|
72
|
+
<dt>N</dt>
|
73
|
+
<dd>
|
74
|
+
<ul>
|
75
|
+
|
76
|
+
<li><a href="#M000013">new</a>,</li>
|
77
|
+
|
78
|
+
<li><a href="#M000015">new_line</a>,</li>
|
79
|
+
|
80
|
+
<li><a href="#M000016">new_line?</a></li>
|
81
|
+
|
82
|
+
</ul>
|
83
|
+
</dd>
|
84
|
+
|
85
|
+
<dt>T</dt>
|
86
|
+
<dd>
|
87
|
+
<ul>
|
88
|
+
|
89
|
+
<li><a href="#M000017">text</a></li>
|
90
|
+
|
91
|
+
</ul>
|
92
|
+
</dd>
|
93
|
+
|
94
|
+
</dl>
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
<div class="sectiontitle">Constants</div>
|
105
|
+
<table border='0' cellpadding='5'>
|
106
|
+
|
107
|
+
<tr valign='top'>
|
108
|
+
<td class="attr-name">Statement</td>
|
109
|
+
<td>=</td>
|
110
|
+
<td class="attr-value">Struct.new :type, :value</td>
|
111
|
+
</tr>
|
112
|
+
|
113
|
+
|
114
|
+
</table>
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
<div class="sectiontitle">Class Public methods</div>
|
121
|
+
|
122
|
+
<div class="method">
|
123
|
+
<div class="title" id="M000013">
|
124
|
+
|
125
|
+
<a name="M000013"></a><b>new</b>(result_variable, continue_result)
|
126
|
+
|
127
|
+
</div>
|
128
|
+
|
129
|
+
<div class="description">
|
130
|
+
<p>
|
131
|
+
Transforms this program into Ruby code which uses the given variable name
|
132
|
+
as the evaluation buffer.
|
133
|
+
</p>
|
134
|
+
<p>
|
135
|
+
If continue_result is true, the evaluation buffer is reused if it already
|
136
|
+
exists in the rendering context.
|
137
|
+
</p>
|
138
|
+
|
139
|
+
</div>
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
<div class="sourcecode">
|
145
|
+
<p class="source-link">
|
146
|
+
Source: <a href="javascript:toggleSource('M000013_source')" id="l_M000013_source">show</a>
|
147
|
+
|
148
|
+
</p>
|
149
|
+
<div id="M000013_source" class="dyn-source">
|
150
|
+
<pre><span class="ruby-comment cmt"># File lib/ember/template.rb, line 435</span>
|
151
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">result_variable</span>, <span class="ruby-identifier">continue_result</span>
|
152
|
+
<span class="ruby-ivar">@result_variable</span> = <span class="ruby-identifier">result_variable</span>
|
153
|
+
<span class="ruby-ivar">@continue_result</span> = <span class="ruby-identifier">continue_result</span>
|
154
|
+
<span class="ruby-ivar">@source_lines</span> = [] <span class="ruby-comment cmt"># each line is composed of multiple statements</span>
|
155
|
+
<span class="ruby-keyword kw">end</span></pre>
|
156
|
+
</div>
|
157
|
+
</div>
|
158
|
+
|
159
|
+
</div>
|
160
|
+
|
161
|
+
<div class="sectiontitle">Instance Public methods</div>
|
162
|
+
|
163
|
+
<div class="method">
|
164
|
+
<div class="title" id="M000018">
|
165
|
+
|
166
|
+
<a name="M000018"></a><b>code</b>(value)
|
167
|
+
|
168
|
+
</div>
|
169
|
+
|
170
|
+
<div class="description">
|
171
|
+
<p>
|
172
|
+
Schedules the given Ruby code to be evaluated when this program is run.
|
173
|
+
</p>
|
174
|
+
|
175
|
+
</div>
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
<div class="sourcecode">
|
181
|
+
<p class="source-link">
|
182
|
+
Source: <a href="javascript:toggleSource('M000018_source')" id="l_M000018_source">show</a>
|
183
|
+
|
184
|
+
</p>
|
185
|
+
<div id="M000018_source" class="dyn-source">
|
186
|
+
<pre><span class="ruby-comment cmt"># File lib/ember/template.rb, line 484</span>
|
187
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">code</span> <span class="ruby-identifier">value</span>
|
188
|
+
<span class="ruby-identifier">statement</span> <span class="ruby-identifier">:code</span>, <span class="ruby-identifier">value</span>
|
189
|
+
<span class="ruby-keyword kw">end</span></pre>
|
190
|
+
</div>
|
191
|
+
</div>
|
192
|
+
|
193
|
+
</div>
|
194
|
+
|
195
|
+
<div class="method">
|
196
|
+
<div class="title" id="M000021">
|
197
|
+
|
198
|
+
<a name="M000021"></a><b>compile</b>()
|
199
|
+
|
200
|
+
</div>
|
201
|
+
|
202
|
+
<div class="description">
|
203
|
+
<p>
|
204
|
+
Transforms this program into executable Ruby source code.
|
205
|
+
</p>
|
206
|
+
|
207
|
+
</div>
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
<div class="sourcecode">
|
213
|
+
<p class="source-link">
|
214
|
+
Source: <a href="javascript:toggleSource('M000021_source')" id="l_M000021_source">show</a>
|
215
|
+
|
216
|
+
</p>
|
217
|
+
<div id="M000021_source" class="dyn-source">
|
218
|
+
<pre><span class="ruby-comment cmt"># File lib/ember/template.rb, line 529</span>
|
219
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">compile</span>
|
220
|
+
<span class="ruby-value str">'(%s %s []; %s; %s.join)'</span> <span class="ruby-operator">%</span> [
|
221
|
+
<span class="ruby-ivar">@result_variable</span>,
|
222
|
+
<span class="ruby-ivar">@continue_result</span> <span class="ruby-operator">?</span> <span class="ruby-value str">'||='</span> <span class="ruby-operator">:</span> <span class="ruby-value str">'='</span>,
|
223
|
+
|
224
|
+
<span class="ruby-ivar">@source_lines</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">source_line</span><span class="ruby-operator">|</span>
|
225
|
+
<span class="ruby-identifier">compiled_line</span> = []
|
226
|
+
<span class="ruby-identifier">combine_prev</span> = <span class="ruby-keyword kw">false</span>
|
227
|
+
|
228
|
+
<span class="ruby-identifier">source_line</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">stmt</span><span class="ruby-operator">|</span>
|
229
|
+
<span class="ruby-identifier">is_code</span> = <span class="ruby-identifier">stmt</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:code</span>
|
230
|
+
<span class="ruby-identifier">is_expr</span> = <span class="ruby-identifier">stmt</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:expr</span>
|
231
|
+
|
232
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">is_code</span>
|
233
|
+
<span class="ruby-identifier">compiled_line</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">stmt</span>.<span class="ruby-identifier">value</span>
|
234
|
+
<span class="ruby-identifier">combine_prev</span> = <span class="ruby-keyword kw">false</span>
|
235
|
+
|
236
|
+
<span class="ruby-keyword kw">else</span>
|
237
|
+
<span class="ruby-identifier">code</span> =
|
238
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">is_expr</span>
|
239
|
+
<span class="ruby-node">" << (#{stmt.value})"</span>
|
240
|
+
<span class="ruby-keyword kw">else</span>
|
241
|
+
<span class="ruby-node">" << #{stmt.value.inspect}"</span>
|
242
|
+
<span class="ruby-keyword kw">end</span>
|
243
|
+
|
244
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">combine_prev</span>
|
245
|
+
<span class="ruby-identifier">compiled_line</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">code</span>
|
246
|
+
<span class="ruby-keyword kw">else</span>
|
247
|
+
<span class="ruby-identifier">compiled_line</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@result_variable</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">code</span>
|
248
|
+
<span class="ruby-keyword kw">end</span>
|
249
|
+
|
250
|
+
<span class="ruby-identifier">combine_prev</span> = <span class="ruby-keyword kw">true</span>
|
251
|
+
<span class="ruby-keyword kw">end</span>
|
252
|
+
<span class="ruby-keyword kw">end</span>
|
253
|
+
|
254
|
+
<span class="ruby-identifier">compiled_line</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">'; '</span>)
|
255
|
+
|
256
|
+
<span class="ruby-keyword kw">end</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"\n"</span>),
|
257
|
+
|
258
|
+
<span class="ruby-ivar">@result_variable</span>,
|
259
|
+
]
|
260
|
+
<span class="ruby-keyword kw">end</span></pre>
|
261
|
+
</div>
|
262
|
+
</div>
|
263
|
+
|
264
|
+
</div>
|
265
|
+
|
266
|
+
<div class="method">
|
267
|
+
<div class="title" id="M000020">
|
268
|
+
|
269
|
+
<a name="M000020"></a><b>emit_end</b>()
|
270
|
+
|
271
|
+
</div>
|
272
|
+
|
273
|
+
<div class="description">
|
274
|
+
<p>
|
275
|
+
Inserts an <% end %> directive before the oldest non-whitespace statement
|
276
|
+
possible.
|
277
|
+
</p>
|
278
|
+
<p>
|
279
|
+
Preceding lines that only emit whitespace are skipped.
|
280
|
+
</p>
|
281
|
+
|
282
|
+
</div>
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
<div class="sourcecode">
|
288
|
+
<p class="source-link">
|
289
|
+
Source: <a href="javascript:toggleSource('M000020_source')" id="l_M000020_source">show</a>
|
290
|
+
|
291
|
+
</p>
|
292
|
+
<div id="M000020_source" class="dyn-source">
|
293
|
+
<pre><span class="ruby-comment cmt"># File lib/ember/template.rb, line 502</span>
|
294
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">emit_end</span>
|
295
|
+
<span class="ruby-identifier">ending</span> = <span class="ruby-constant">Statement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:code</span>, <span class="ruby-identifier">:end</span>)
|
296
|
+
<span class="ruby-identifier">current</span> = <span class="ruby-identifier">insertion_point</span>
|
297
|
+
|
298
|
+
<span class="ruby-identifier">can_skip_line</span> = <span class="ruby-identifier">lambda</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
299
|
+
<span class="ruby-identifier">line</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span>
|
300
|
+
<span class="ruby-identifier">line</span>.<span class="ruby-identifier">all?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">stmt</span><span class="ruby-operator">|</span> <span class="ruby-identifier">stmt</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:text</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">stmt</span>.<span class="ruby-identifier">value</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\A\s*\z/</span> }
|
301
|
+
<span class="ruby-keyword kw">end</span>
|
302
|
+
|
303
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">can_skip_line</span>[<span class="ruby-identifier">current</span>]
|
304
|
+
<span class="ruby-identifier">target</span> = <span class="ruby-identifier">current</span>
|
305
|
+
|
306
|
+
<span class="ruby-comment cmt"># skip past empty whitespace in previous lines</span>
|
307
|
+
<span class="ruby-ivar">@source_lines</span>.<span class="ruby-identifier">reverse_each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
308
|
+
<span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">can_skip_line</span>[<span class="ruby-identifier">line</span>]
|
309
|
+
<span class="ruby-identifier">target</span> = <span class="ruby-identifier">line</span>
|
310
|
+
<span class="ruby-keyword kw">end</span>
|
311
|
+
|
312
|
+
<span class="ruby-identifier">target</span>.<span class="ruby-identifier">unshift</span> <span class="ruby-identifier">ending</span>
|
313
|
+
<span class="ruby-keyword kw">else</span>
|
314
|
+
<span class="ruby-identifier">current</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">ending</span>
|
315
|
+
<span class="ruby-keyword kw">end</span>
|
316
|
+
<span class="ruby-keyword kw">end</span></pre>
|
317
|
+
</div>
|
318
|
+
</div>
|
319
|
+
|
320
|
+
</div>
|
321
|
+
|
322
|
+
<div class="method">
|
323
|
+
<div class="title" id="M000014">
|
324
|
+
|
325
|
+
<a name="M000014"></a><b>empty?</b>()
|
326
|
+
|
327
|
+
</div>
|
328
|
+
|
329
|
+
<div class="description">
|
330
|
+
<p>
|
331
|
+
Returns true if there are no source lines in this program.
|
332
|
+
</p>
|
333
|
+
|
334
|
+
</div>
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
<div class="sourcecode">
|
340
|
+
<p class="source-link">
|
341
|
+
Source: <a href="javascript:toggleSource('M000014_source')" id="l_M000014_source">show</a>
|
342
|
+
|
343
|
+
</p>
|
344
|
+
<div id="M000014_source" class="dyn-source">
|
345
|
+
<pre><span class="ruby-comment cmt"># File lib/ember/template.rb, line 444</span>
|
346
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">empty?</span>
|
347
|
+
<span class="ruby-ivar">@source_lines</span>.<span class="ruby-identifier">empty?</span>
|
348
|
+
<span class="ruby-keyword kw">end</span></pre>
|
349
|
+
</div>
|
350
|
+
</div>
|
351
|
+
|
352
|
+
</div>
|
353
|
+
|
354
|
+
<div class="method">
|
355
|
+
<div class="title" id="M000019">
|
356
|
+
|
357
|
+
<a name="M000019"></a><b>expr</b>(value)
|
358
|
+
|
359
|
+
</div>
|
360
|
+
|
361
|
+
<div class="description">
|
362
|
+
<p>
|
363
|
+
Schedules the given Ruby code to be evaluated and inserted into the
|
364
|
+
evaluation buffer when this program is run.
|
365
|
+
</p>
|
366
|
+
|
367
|
+
</div>
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
<div class="sourcecode">
|
373
|
+
<p class="source-link">
|
374
|
+
Source: <a href="javascript:toggleSource('M000019_source')" id="l_M000019_source">show</a>
|
375
|
+
|
376
|
+
</p>
|
377
|
+
<div id="M000019_source" class="dyn-source">
|
378
|
+
<pre><span class="ruby-comment cmt"># File lib/ember/template.rb, line 492</span>
|
379
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">expr</span> <span class="ruby-identifier">value</span>
|
380
|
+
<span class="ruby-identifier">statement</span> <span class="ruby-identifier">:expr</span>, <span class="ruby-identifier">value</span>
|
381
|
+
<span class="ruby-keyword kw">end</span></pre>
|
382
|
+
</div>
|
383
|
+
</div>
|
384
|
+
|
385
|
+
</div>
|
386
|
+
|
387
|
+
<div class="method">
|
388
|
+
<div class="title" id="M000015">
|
389
|
+
|
390
|
+
<a name="M000015"></a><b>new_line</b>()
|
391
|
+
|
392
|
+
</div>
|
393
|
+
|
394
|
+
<div class="description">
|
395
|
+
<p>
|
396
|
+
Begins a new line in the program’s source code.
|
397
|
+
</p>
|
398
|
+
|
399
|
+
</div>
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
<div class="sourcecode">
|
405
|
+
<p class="source-link">
|
406
|
+
Source: <a href="javascript:toggleSource('M000015_source')" id="l_M000015_source">show</a>
|
407
|
+
|
408
|
+
</p>
|
409
|
+
<div id="M000015_source" class="dyn-source">
|
410
|
+
<pre><span class="ruby-comment cmt"># File lib/ember/template.rb, line 451</span>
|
411
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new_line</span>
|
412
|
+
<span class="ruby-ivar">@source_lines</span> <span class="ruby-operator"><<</span> []
|
413
|
+
<span class="ruby-keyword kw">end</span></pre>
|
414
|
+
</div>
|
415
|
+
</div>
|
416
|
+
|
417
|
+
</div>
|
418
|
+
|
419
|
+
<div class="method">
|
420
|
+
<div class="title" id="M000016">
|
421
|
+
|
422
|
+
<a name="M000016"></a><b>new_line?</b>()
|
423
|
+
|
424
|
+
</div>
|
425
|
+
|
426
|
+
<div class="description">
|
427
|
+
<p>
|
428
|
+
Returns true if a new (blank) line is ready in the program’s source
|
429
|
+
code.
|
430
|
+
</p>
|
431
|
+
|
432
|
+
</div>
|
433
|
+
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
<div class="sourcecode">
|
438
|
+
<p class="source-link">
|
439
|
+
Source: <a href="javascript:toggleSource('M000016_source')" id="l_M000016_source">show</a>
|
440
|
+
|
441
|
+
</p>
|
442
|
+
<div id="M000016_source" class="dyn-source">
|
443
|
+
<pre><span class="ruby-comment cmt"># File lib/ember/template.rb, line 459</span>
|
444
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new_line?</span>
|
445
|
+
<span class="ruby-identifier">ary</span> = <span class="ruby-identifier">insertion_point</span>
|
446
|
+
<span class="ruby-identifier">ary</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">ary</span>.<span class="ruby-identifier">all?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">stmt</span><span class="ruby-operator">|</span> <span class="ruby-identifier">stmt</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:code</span> }
|
447
|
+
<span class="ruby-keyword kw">end</span></pre>
|
448
|
+
</div>
|
449
|
+
</div>
|
450
|
+
|
451
|
+
</div>
|
452
|
+
|
453
|
+
<div class="method">
|
454
|
+
<div class="title" id="M000017">
|
455
|
+
|
456
|
+
<a name="M000017"></a><b>text</b>(value)
|
457
|
+
|
458
|
+
</div>
|
459
|
+
|
460
|
+
<div class="description">
|
461
|
+
<p>
|
462
|
+
Schedules the given text to be inserted verbatim into the evaluation buffer
|
463
|
+
when this program is run.
|
464
|
+
</p>
|
465
|
+
|
466
|
+
</div>
|
467
|
+
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
<div class="sourcecode">
|
472
|
+
<p class="source-link">
|
473
|
+
Source: <a href="javascript:toggleSource('M000017_source')" id="l_M000017_source">show</a>
|
474
|
+
|
475
|
+
</p>
|
476
|
+
<div id="M000017_source" class="dyn-source">
|
477
|
+
<pre><span class="ruby-comment cmt"># File lib/ember/template.rb, line 468</span>
|
478
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">text</span> <span class="ruby-identifier">value</span>
|
479
|
+
<span class="ruby-comment cmt"># don't bother emitting empty strings</span>
|
480
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">empty?</span>
|
481
|
+
|
482
|
+
<span class="ruby-comment cmt"># combine adjacent statements to reduce code size</span>
|
483
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">prev</span> = <span class="ruby-identifier">insertion_point</span>.<span class="ruby-identifier">last</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">prev</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:text</span>
|
484
|
+
<span class="ruby-identifier">prev</span>.<span class="ruby-identifier">value</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">value</span>
|
485
|
+
<span class="ruby-keyword kw">else</span>
|
486
|
+
<span class="ruby-identifier">statement</span> <span class="ruby-identifier">:text</span>, <span class="ruby-identifier">value</span>
|
487
|
+
<span class="ruby-keyword kw">end</span>
|
488
|
+
<span class="ruby-keyword kw">end</span></pre>
|
489
|
+
</div>
|
490
|
+
</div>
|
491
|
+
|
492
|
+
</div>
|
493
|
+
|
494
|
+
</div>
|
495
|
+
</div>
|
496
|
+
</body>
|
497
|
+
</html>
|