ember 0.0.0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/ember +2 -2
- data/doc/api/apple-touch-icon.png +0 -0
- data/doc/api/classes/Ember/Template.html +27 -10
- data/doc/api/classes/Ember/Template/Program.html +0 -437
- data/doc/api/created.rid +1 -1
- data/doc/api/favicon.ico +0 -0
- data/doc/api/files/LICENSE.html +1 -1
- data/doc/api/files/lib/ember/template_rb.html +1 -1
- data/doc/api/files/lib/ember_rb.html +1 -1
- data/doc/api/js/searchdoc.js +38 -15
- data/doc/api/panel/index.html +13 -5
- data/doc/api/panel/search_index.js +1 -1
- data/doc/api/panel/tree.js +1 -1
- data/doc/ember.png +0 -0
- data/doc/ember.svg +784 -0
- data/doc/history.erb +27 -2
- data/doc/index.erb +2 -2
- data/doc/index.html +1624 -0
- data/doc/intro.erb +34 -60
- data/doc/setup.erb +51 -2
- data/doc/usage.erb +34 -3
- data/lib/ember.rb +5 -5
- data/lib/ember/template.rb +33 -23
- data/rakefile +2 -2
- metadata +12 -6
- data/doc/index.xhtml +0 -758
data/bin/ember
CHANGED
Binary file
|
@@ -178,9 +178,11 @@ options[:source_file] if that is a valid path.
|
|
178
178
|
<p class="source-link">
|
179
179
|
Source: <a href="javascript:toggleSource('M000003_source')" id="l_M000003_source">show</a>
|
180
180
|
|
181
|
+
| <a href="http://github.com/sunaku/ember/blob/f6b6ad4d02813bfe061fe18469d2d20395699d65/lib/ember/template.rb#L103" target="_blank" class="github_url">on GitHub</a>
|
182
|
+
|
181
183
|
</p>
|
182
184
|
<div id="M000003_source" class="dyn-source">
|
183
|
-
<pre><span class="ruby-comment cmt"># File lib/ember/template.rb, line
|
185
|
+
<pre><span class="ruby-comment cmt"># File lib/ember/template.rb, line 103</span>
|
184
186
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_file</span> <span class="ruby-identifier">path</span>, <span class="ruby-identifier">options</span> = {}
|
185
187
|
<span class="ruby-identifier">path</span> = <span class="ruby-identifier">resolve_path</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">options</span>)
|
186
188
|
<span class="ruby-identifier">new</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">path</span>), <span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">:source_file</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">path</span>)
|
@@ -204,7 +206,7 @@ according to the given options.
|
|
204
206
|
</p>
|
205
207
|
<p>
|
206
208
|
This processor transforms the given input into an executable Ruby program
|
207
|
-
(provided by the
|
209
|
+
(provided by the program() method) which is then executed by the render()
|
208
210
|
method on demand.
|
209
211
|
</p>
|
210
212
|
<p>
|
@@ -271,11 +273,14 @@ The default value is false.
|
|
271
273
|
<p class="source-link">
|
272
274
|
Source: <a href="javascript:toggleSource('M000000_source')" id="l_M000000_source">show</a>
|
273
275
|
|
276
|
+
| <a href="http://github.com/sunaku/ember/blob/f6b6ad4d02813bfe061fe18469d2d20395699d65/lib/ember/template.rb#L64" target="_blank" class="github_url">on GitHub</a>
|
277
|
+
|
274
278
|
</p>
|
275
279
|
<div id="M000000_source" class="dyn-source">
|
276
|
-
<pre><span class="ruby-comment cmt"># File lib/ember/template.rb, line
|
280
|
+
<pre><span class="ruby-comment cmt"># File lib/ember/template.rb, line 64</span>
|
277
281
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">input</span>, <span class="ruby-identifier">options</span> = {}
|
278
282
|
<span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
|
283
|
+
<span class="ruby-ivar">@render_context_id</span> = <span class="ruby-identifier">object_id</span>
|
279
284
|
<span class="ruby-ivar">@compile</span> = <span class="ruby-identifier">compile</span>(<span class="ruby-identifier">input</span>.<span class="ruby-identifier">to_s</span>)
|
280
285
|
<span class="ruby-keyword kw">end</span></pre>
|
281
286
|
</div>
|
@@ -309,9 +314,11 @@ options[:source_file] if that is a valid path.
|
|
309
314
|
<p class="source-link">
|
310
315
|
Source: <a href="javascript:toggleSource('M000004_source')" id="l_M000004_source">show</a>
|
311
316
|
|
317
|
+
| <a href="http://github.com/sunaku/ember/blob/f6b6ad4d02813bfe061fe18469d2d20395699d65/lib/ember/template.rb#L115" target="_blank" class="github_url">on GitHub</a>
|
318
|
+
|
312
319
|
</p>
|
313
320
|
<div id="M000004_source" class="dyn-source">
|
314
|
-
<pre><span class="ruby-comment cmt"># File lib/ember/template.rb, line
|
321
|
+
<pre><span class="ruby-comment cmt"># File lib/ember/template.rb, line 115</span>
|
315
322
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read_file</span> <span class="ruby-identifier">path</span>, <span class="ruby-identifier">options</span> = {}
|
316
323
|
<span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span> <span class="ruby-identifier">resolve_path</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">options</span>)
|
317
324
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -344,9 +351,11 @@ constructor of this class.
|
|
344
351
|
<p class="source-link">
|
345
352
|
Source: <a href="javascript:toggleSource('M000001_source')" id="l_M000001_source">show</a>
|
346
353
|
|
354
|
+
| <a href="http://github.com/sunaku/ember/blob/f6b6ad4d02813bfe061fe18469d2d20395699d65/lib/ember/template.rb#L74" target="_blank" class="github_url">on GitHub</a>
|
355
|
+
|
347
356
|
</p>
|
348
357
|
<div id="M000001_source" class="dyn-source">
|
349
|
-
<pre><span class="ruby-comment cmt"># File lib/ember/template.rb, line
|
358
|
+
<pre><span class="ruby-comment cmt"># File lib/ember/template.rb, line 74</span>
|
350
359
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">program</span>
|
351
360
|
<span class="ruby-ivar">@compile</span>
|
352
361
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -358,14 +367,14 @@ constructor of this class.
|
|
358
367
|
<div class="method">
|
359
368
|
<div class="title" id="M000002">
|
360
369
|
|
361
|
-
<a name="M000002"></a><b>render</b>(context = TOPLEVEL_BINDING)
|
370
|
+
<a name="M000002"></a><b>render</b>(context = TOPLEVEL_BINDING, parent_context_id = nil)
|
362
371
|
|
363
372
|
</div>
|
364
373
|
|
365
374
|
<div class="description">
|
366
375
|
<p>
|
367
376
|
Returns the result of executing the Ruby program for this template
|
368
|
-
(provided by the
|
377
|
+
(provided by the program() method) inside the given context binding.
|
369
378
|
</p>
|
370
379
|
|
371
380
|
</div>
|
@@ -377,13 +386,21 @@ Returns the result of executing the Ruby program for this template
|
|
377
386
|
<p class="source-link">
|
378
387
|
Source: <a href="javascript:toggleSource('M000002_source')" id="l_M000002_source">show</a>
|
379
388
|
|
389
|
+
| <a href="http://github.com/sunaku/ember/blob/f6b6ad4d02813bfe061fe18469d2d20395699d65/lib/ember/template.rb#L84" target="_blank" class="github_url">on GitHub</a>
|
390
|
+
|
380
391
|
</p>
|
381
392
|
<div id="M000002_source" class="dyn-source">
|
382
|
-
<pre><span class="ruby-comment cmt"># File lib/ember/template.rb, line
|
383
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span>
|
384
|
-
<span class="ruby-identifier">
|
393
|
+
<pre><span class="ruby-comment cmt"># File lib/ember/template.rb, line 84</span>
|
394
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span> <span class="ruby-identifier">context</span> = <span class="ruby-constant">TOPLEVEL_BINDING</span>, <span class="ruby-identifier">parent_context_id</span> = <span class="ruby-keyword kw">nil</span>
|
395
|
+
<span class="ruby-identifier">context</span> <span class="ruby-operator">||=</span> <span class="ruby-ivar">@@contexts</span>[<span class="ruby-identifier">parent_context_id</span>] <span class="ruby-comment cmt"># inherit parent context</span>
|
396
|
+
<span class="ruby-ivar">@@contexts</span>[<span class="ruby-ivar">@render_context_id</span>] = <span class="ruby-identifier">context</span> <span class="ruby-comment cmt"># provide to children</span>
|
397
|
+
|
398
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-identifier">eval</span> <span class="ruby-ivar">@compile</span>, <span class="ruby-identifier">context</span>,
|
385
399
|
(<span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:source_file</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">:SOURCE</span>).<span class="ruby-identifier">to_s</span>,
|
386
400
|
(<span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:source_line</span>] <span class="ruby-operator">||</span> <span class="ruby-value">1</span>).<span class="ruby-identifier">to_i</span>
|
401
|
+
|
402
|
+
<span class="ruby-ivar">@@contexts</span>.<span class="ruby-identifier">delete</span> <span class="ruby-ivar">@render_context_id</span> <span class="ruby-comment cmt"># free the memory</span>
|
403
|
+
<span class="ruby-identifier">result</span>
|
387
404
|
<span class="ruby-keyword kw">end</span></pre>
|
388
405
|
</div>
|
389
406
|
</div>
|
@@ -42,57 +42,6 @@
|
|
42
42
|
|
43
43
|
|
44
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
45
|
|
97
46
|
|
98
47
|
|
@@ -101,396 +50,10 @@
|
|
101
50
|
|
102
51
|
|
103
52
|
|
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
53
|
|
117
54
|
|
118
55
|
|
119
56
|
|
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
57
|
</div>
|
495
58
|
</div>
|
496
59
|
</body>
|