ember 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/HISTORY +79 -0
  2. data/INSTALL +31 -0
  3. data/MANUAL +25 -0
  4. data/README +54 -0
  5. data/THEORY +151 -0
  6. data/USAGE +250 -0
  7. data/bin/ember +58 -20
  8. data/doc/ann.xml +93 -0
  9. data/doc/api/Ember.html +436 -0
  10. data/doc/api/Ember/Template.html +774 -0
  11. data/doc/api/Ember/Template/Program.html +877 -0
  12. data/doc/api/Ember/Template/Program/Statement.html +181 -0
  13. data/doc/api/_index.html +139 -0
  14. data/doc/api/class_list.html +36 -0
  15. data/doc/api/css/common.css +1 -0
  16. data/doc/api/css/full_list.css +50 -0
  17. data/doc/api/css/style.css +273 -0
  18. data/doc/api/file.LICENSE.html +73 -0
  19. data/doc/api/file_list.html +38 -0
  20. data/doc/api/frames.html +13 -0
  21. data/doc/api/index.html +72 -13
  22. data/doc/api/js/app.js +111 -0
  23. data/doc/api/js/full_list.js +117 -0
  24. data/doc/api/js/{jquery-1.3.2.min.js → jquery.js} +0 -0
  25. data/doc/api/method_list.html +179 -0
  26. data/doc/api/top-level-namespace.html +87 -0
  27. data/doc/index.html +1353 -682
  28. data/inochi.opts +31 -0
  29. data/lib/ember.rb +1 -15
  30. data/lib/ember/inochi.rb +103 -0
  31. data/lib/ember/template.rb +66 -78
  32. data/test/combinatorics.rb +188 -0
  33. data/test/ember/template_test.rb +137 -0
  34. data/test/runner +25 -0
  35. data/test/test_helper.rb +5 -0
  36. metadata +61 -51
  37. data/doc/api/apple-touch-icon.png +0 -0
  38. data/doc/api/classes/Ember.html +0 -61
  39. data/doc/api/classes/Ember/Template.html +0 -413
  40. data/doc/api/classes/Ember/Template/Program.html +0 -60
  41. data/doc/api/created.rid +0 -1
  42. data/doc/api/css/main.css +0 -263
  43. data/doc/api/css/panel.css +0 -383
  44. data/doc/api/css/reset.css +0 -53
  45. data/doc/api/favicon.ico +0 -0
  46. data/doc/api/files/LICENSE.html +0 -76
  47. data/doc/api/files/lib/ember/template_rb.html +0 -66
  48. data/doc/api/files/lib/ember_rb.html +0 -63
  49. data/doc/api/i/arrows.png +0 -0
  50. data/doc/api/i/results_bg.png +0 -0
  51. data/doc/api/i/tree_bg.png +0 -0
  52. data/doc/api/js/jquery-effect.js +0 -593
  53. data/doc/api/js/main.js +0 -22
  54. data/doc/api/js/searchdoc.js +0 -628
  55. data/doc/api/panel/index.html +0 -71
  56. data/doc/api/panel/search_index.js +0 -1
  57. data/doc/api/panel/tree.js +0 -1
  58. data/doc/history.erb +0 -34
  59. data/doc/index.erb +0 -11
  60. data/doc/intro.erb +0 -53
  61. data/doc/setup.erb +0 -78
  62. data/doc/usage.erb +0 -280
  63. data/rakefile +0 -14
  64. data/test/ember.rb +0 -17
  65. data/test/ember/template.rb +0 -141
@@ -0,0 +1,877 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta name="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>Class: Ember::Template::Program</title>
7
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
8
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
9
+
10
+ <script type="text/javascript" charset="utf-8">
11
+ relpath = '../..';
12
+ if (relpath != '') relpath += '/';
13
+ </script>
14
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
15
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
16
+
17
+ </head>
18
+ <body>
19
+ <script type="text/javascript" charset="utf-8">
20
+ if (window.top.frames.main) document.body.className = 'frames';
21
+ </script>
22
+
23
+ <div id="header">
24
+ <div id="menu">
25
+
26
+ <a href="../../_index.html">Index (P)</a> &raquo;
27
+ <span class='title'><a href="../../Ember.html" title="Ember (module)">Ember</a></span> &raquo; <span class='title'><a href="../Template.html" title="Ember::Template (class)">Template</a></span>
28
+ &raquo;
29
+ <span class="title">Program</span>
30
+
31
+
32
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
33
+ </div>
34
+
35
+ <div id="search">
36
+ <a id="class_list_link" href="#">Class List</a>
37
+ <a id="method_list_link" href="#">Method List</a>
38
+ <a id ="file_list_link" href="#">File List</a>
39
+ </div>
40
+
41
+ <div class="clear"></div>
42
+ </div>
43
+
44
+ <iframe id="search_frame"></iframe>
45
+
46
+ <div id="content"><h1>Class: Ember::Template::Program
47
+
48
+
49
+ </h1>
50
+
51
+ <dl class="box">
52
+
53
+ <dt class="r1">Inherits:</dt>
54
+ <dd class="r1">
55
+ <span class="inheritName">Object</span>
56
+
57
+ <ul class="fullTree">
58
+ <li>Object</li>
59
+
60
+ <li class="next">Ember::Template::Program</li>
61
+
62
+ </ul>
63
+ <a href="#" class="inheritanceTree">show all</a>
64
+
65
+ </dd>
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+ <dt class="r2 last">Defined in:</dt>
76
+ <dd class="r2 last">lib/ember/template.rb</dd>
77
+
78
+ </dl>
79
+ <div class="clear"></div>
80
+
81
+ <h2>Overview</h2><div class="docstring">
82
+ <div class="discussion">
83
+ <p>
84
+ :nodoc:
85
+ </p>
86
+
87
+
88
+ </div>
89
+ </div>
90
+ <div class="tags">
91
+
92
+ </div><h2>Defined Under Namespace</h2>
93
+ <p class="children">
94
+
95
+
96
+
97
+
98
+ <strong class="classes">Classes:</strong> <a href="Program/Statement.html" title="Ember::Template::Program::Statement (class)">Statement</a>
99
+
100
+
101
+ </p>
102
+
103
+
104
+
105
+
106
+ <h2>Instance Method Summary</h2>
107
+
108
+ <ul class="summary">
109
+
110
+ <li class="public ">
111
+ <span class="summary_signature">
112
+
113
+ <a href="#compile-instance_method" title="#compile (instance method)">- (Object) <strong>compile</strong> </a>
114
+
115
+
116
+
117
+ </span>
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+ <span class="summary_desc"><div class='inline'><p>
126
+ Transforms this program into executable Ruby source code.
127
+ </p>
128
+ </div></span>
129
+
130
+ </li>
131
+
132
+
133
+ <li class="public ">
134
+ <span class="summary_signature">
135
+
136
+ <a href="#emit_code-instance_method" title="#emit_code (instance method)">- (Object) <strong>emit_code</strong>(value) </a>
137
+
138
+
139
+
140
+ </span>
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+ <span class="summary_desc"><div class='inline'><p>
149
+ Schedules the given Ruby code to be evaluated when this program is run.
150
+ </p>
151
+ </div></span>
152
+
153
+ </li>
154
+
155
+
156
+ <li class="public ">
157
+ <span class="summary_signature">
158
+
159
+ <a href="#emit_end-instance_method" title="#emit_end (instance method)">- (Object) <strong>emit_end</strong> </a>
160
+
161
+
162
+
163
+ </span>
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+ <span class="summary_desc"><div class='inline'><p>
172
+ Inserts an <% end %> directive before the oldest non-whitespace statement
173
+ possible.
174
+ </p>
175
+ </div></span>
176
+
177
+ </li>
178
+
179
+
180
+ <li class="public ">
181
+ <span class="summary_signature">
182
+
183
+ <a href="#emit_expr-instance_method" title="#emit_expr (instance method)">- (Object) <strong>emit_expr</strong>(value) </a>
184
+
185
+
186
+
187
+ </span>
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+ <span class="summary_desc"><div class='inline'><p>
196
+ Schedules the given Ruby code to be evaluated and inserted into the
197
+ evaluation buffer when this program is run.
198
+ </p>
199
+ </div></span>
200
+
201
+ </li>
202
+
203
+
204
+ <li class="public ">
205
+ <span class="summary_signature">
206
+
207
+ <a href="#emit_text-instance_method" title="#emit_text (instance method)">- (Object) <strong>emit_text</strong>(value) </a>
208
+
209
+
210
+
211
+ </span>
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+ <span class="summary_desc"><div class='inline'><p>
220
+ Schedules the given text to be inserted verbatim into the evaluation buffer
221
+ when this program is run.
222
+ </p>
223
+ </div></span>
224
+
225
+ </li>
226
+
227
+
228
+ <li class="public ">
229
+ <span class="summary_signature">
230
+
231
+ <a href="#empty%3F-instance_method" title="#empty? (instance method)">- (Boolean) <strong>empty?</strong> </a>
232
+
233
+
234
+
235
+ </span>
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+ <span class="summary_desc"><div class='inline'><p>
244
+ Returns true if there are no source lines in this program.
245
+ </p>
246
+ </div></span>
247
+
248
+ </li>
249
+
250
+
251
+ <li class="public ">
252
+ <span class="summary_signature">
253
+
254
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Program) <strong>initialize</strong>(result_variable, continue_result) </a>
255
+
256
+
257
+
258
+ </span>
259
+
260
+ <span class="note title constructor">constructor</span>
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+ <span class="summary_desc"><div class='inline'><p>
269
+ Transforms this program into Ruby code which uses the given variable name
270
+ as the evaluation buffer.
271
+ </p>
272
+ </div></span>
273
+
274
+ </li>
275
+
276
+
277
+ <li class="public ">
278
+ <span class="summary_signature">
279
+
280
+ <a href="#new_line-instance_method" title="#new_line (instance method)">- (Object) <strong>new_line</strong> </a>
281
+
282
+
283
+
284
+ </span>
285
+
286
+
287
+
288
+
289
+
290
+
291
+
292
+ <span class="summary_desc"><div class='inline'><p>
293
+ Begins a new line in the program&#8217;s source code.
294
+ </p>
295
+ </div></span>
296
+
297
+ </li>
298
+
299
+
300
+ <li class="public ">
301
+ <span class="summary_signature">
302
+
303
+ <a href="#new_line%3F-instance_method" title="#new_line? (instance method)">- (Boolean) <strong>new_line?</strong> </a>
304
+
305
+
306
+
307
+ </span>
308
+
309
+
310
+
311
+
312
+
313
+
314
+
315
+ <span class="summary_desc"><div class='inline'><p>
316
+ Returns true if a new (blank) line is ready in the program&#8217;s source
317
+ code.
318
+ </p>
319
+ </div></span>
320
+
321
+ </li>
322
+
323
+
324
+ </ul>
325
+
326
+
327
+ <div id="constructor_details" class="method_details_list">
328
+ <h2>Constructor Details</h2>
329
+
330
+ <div class="method_details first">
331
+ <p class="signature first" id="initialize-instance_method">
332
+
333
+ - (<tt><a href="" title="Ember::Template::Program (class)">Program</a></tt>) <strong>initialize</strong>(result_variable, continue_result)
334
+
335
+
336
+
337
+ </p><div class="docstring">
338
+ <div class="discussion">
339
+ <p>
340
+ Transforms this program into Ruby code which uses the given variable name
341
+ as the evaluation buffer.
342
+ </p>
343
+ <p>
344
+ If continue_result is true, the evaluation buffer is reused if it already
345
+ exists in the rendering context.
346
+ </p>
347
+
348
+
349
+ </div>
350
+ </div>
351
+ <div class="tags">
352
+
353
+ </div><table class="source_code">
354
+ <tr>
355
+ <td>
356
+ <pre class="lines">
357
+
358
+
359
+ 433
360
+ 434
361
+ 435
362
+ 436
363
+ 437</pre>
364
+ </td>
365
+ <td>
366
+ <pre class="code"><span class="info file"># File 'lib/ember/template.rb', line 433</span>
367
+
368
+ <span class='kw'>def</span> <span class='id initialize'>initialize</span> <span class='id result_variable'>result_variable</span><span class='comma'>,</span> <span class='id continue_result'>continue_result</span>
369
+ <span class='ivar'>@result_variable</span> <span class='op'>=</span> <span class='id result_variable'>result_variable</span>
370
+ <span class='ivar'>@continue_result</span> <span class='op'>=</span> <span class='id continue_result'>continue_result</span>
371
+ <span class='ivar'>@source_lines</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='comment'># each line is composed of multiple statements
372
+ </span><span class='kw'>end</span></pre>
373
+ </td>
374
+ </tr>
375
+ </table>
376
+ </div>
377
+
378
+ </div>
379
+
380
+
381
+ <div id="instance_method_details" class="method_details_list">
382
+ <h2>Instance Method Details</h2>
383
+
384
+
385
+ <div class="method_details first">
386
+ <p class="signature first" id="compile-instance_method">
387
+
388
+ - (<tt>Object</tt>) <strong>compile</strong>
389
+
390
+
391
+
392
+ </p><div class="docstring">
393
+ <div class="discussion">
394
+ <p>
395
+ Transforms this program into executable Ruby source code.
396
+ </p>
397
+
398
+
399
+ </div>
400
+ </div>
401
+ <div class="tags">
402
+
403
+ </div><table class="source_code">
404
+ <tr>
405
+ <td>
406
+ <pre class="lines">
407
+
408
+
409
+ 527
410
+ 528
411
+ 529
412
+ 530
413
+ 531
414
+ 532
415
+ 533
416
+ 534
417
+ 535
418
+ 536
419
+ 537
420
+ 538
421
+ 539
422
+ 540
423
+ 541
424
+ 542
425
+ 543
426
+ 544
427
+ 545
428
+ 546
429
+ 547
430
+ 548
431
+ 549
432
+ 550
433
+ 551
434
+ 552
435
+ 553
436
+ 554
437
+ 555
438
+ 556
439
+ 557
440
+ 558
441
+ 559
442
+ 560
443
+ 561
444
+ 562
445
+ 563
446
+ 564
447
+ 565
448
+ 566
449
+ 567
450
+ 568</pre>
451
+ </td>
452
+ <td>
453
+ <pre class="code"><span class="info file"># File 'lib/ember/template.rb', line 527</span>
454
+
455
+ <span class='kw'>def</span> <span class='id compile'>compile</span>
456
+ <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>(%s %s []; %s; %s.join)</span><span class='tstring_end'>'</span></span> <span class='op'>%</span> <span class='lbracket'>[</span>
457
+ <span class='ivar'>@result_variable</span><span class='comma'>,</span>
458
+ <span class='ivar'>@continue_result</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>||=</span><span class='tstring_end'>'</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>=</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
459
+
460
+ <span class='ivar'>@source_lines</span><span class='period'>.</span><span class='id map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id source_line'>source_line</span><span class='op'>|</span>
461
+ <span class='id compiled_line'>compiled_line</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
462
+ <span class='id combine_prev'>combine_prev</span> <span class='op'>=</span> <span class='kw'>false</span>
463
+
464
+ <span class='id source_line'>source_line</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id stmt'>stmt</span><span class='op'>|</span>
465
+ <span class='id is_code'>is_code</span> <span class='op'>=</span> <span class='id stmt'>stmt</span><span class='period'>.</span><span class='id type'>type</span> <span class='op'>==</span> <span class='symbol'>:code</span>
466
+ <span class='id is_expr'>is_expr</span> <span class='op'>=</span> <span class='id stmt'>stmt</span><span class='period'>.</span><span class='id type'>type</span> <span class='op'>==</span> <span class='symbol'>:expr</span>
467
+
468
+ <span class='kw'>if</span> <span class='id is_code'>is_code</span>
469
+ <span class='id compiled_line'>compiled_line</span> <span class='op'>&lt;&lt;</span> <span class='id stmt'>stmt</span><span class='period'>.</span><span class='id value'>value</span>
470
+ <span class='id combine_prev'>combine_prev</span> <span class='op'>=</span> <span class='kw'>false</span>
471
+
472
+ <span class='kw'>else</span>
473
+ <span class='id code'>code</span> <span class='op'>=</span>
474
+ <span class='kw'>if</span> <span class='id is_expr'>is_expr</span>
475
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> &lt;&lt; (</span><span class='embexpr_beg'>#{</span><span class='id stmt'>stmt</span><span class='period'>.</span><span class='id value'>value</span><span class='rbrace'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>&quot;</span></span>
476
+ <span class='kw'>else</span>
477
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> &lt;&lt; </span><span class='embexpr_beg'>#{</span><span class='id stmt'>stmt</span><span class='period'>.</span><span class='id value'>value</span><span class='period'>.</span><span class='id inspect'>inspect</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
478
+ <span class='kw'>end</span>
479
+
480
+ <span class='kw'>if</span> <span class='id combine_prev'>combine_prev</span>
481
+ <span class='id compiled_line'>compiled_line</span><span class='period'>.</span><span class='id last'>last</span> <span class='op'>&lt;&lt;</span> <span class='id code'>code</span>
482
+ <span class='kw'>else</span>
483
+ <span class='id compiled_line'>compiled_line</span> <span class='op'>&lt;&lt;</span> <span class='ivar'>@result_variable</span><span class='period'>.</span><span class='id to_s'>to_s</span> <span class='op'>+</span> <span class='id code'>code</span>
484
+ <span class='kw'>end</span>
485
+
486
+ <span class='id combine_prev'>combine_prev</span> <span class='op'>=</span> <span class='kw'>true</span>
487
+ <span class='kw'>end</span>
488
+ <span class='kw'>end</span>
489
+
490
+ <span class='id compiled_line'>compiled_line</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>; </span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
491
+
492
+ <span class='kw'>end</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='comma'>,</span>
493
+
494
+ <span class='ivar'>@result_variable</span><span class='comma'>,</span>
495
+ <span class='rbracket'>]</span>
496
+ <span class='kw'>end</span></pre>
497
+ </td>
498
+ </tr>
499
+ </table>
500
+ </div>
501
+
502
+ <div class="method_details ">
503
+ <p class="signature " id="emit_code-instance_method">
504
+
505
+ - (<tt>Object</tt>) <strong>emit_code</strong>(value)
506
+
507
+
508
+
509
+ </p><div class="docstring">
510
+ <div class="discussion">
511
+ <p>
512
+ Schedules the given Ruby code to be evaluated when this program is run.
513
+ </p>
514
+
515
+
516
+ </div>
517
+ </div>
518
+ <div class="tags">
519
+
520
+ </div><table class="source_code">
521
+ <tr>
522
+ <td>
523
+ <pre class="lines">
524
+
525
+
526
+ 482
527
+ 483
528
+ 484</pre>
529
+ </td>
530
+ <td>
531
+ <pre class="code"><span class="info file"># File 'lib/ember/template.rb', line 482</span>
532
+
533
+ <span class='kw'>def</span> <span class='id emit_code'>emit_code</span> <span class='id value'>value</span>
534
+ <span class='id statement'>statement</span> <span class='symbol'>:code</span><span class='comma'>,</span> <span class='id value'>value</span>
535
+ <span class='kw'>end</span></pre>
536
+ </td>
537
+ </tr>
538
+ </table>
539
+ </div>
540
+
541
+ <div class="method_details ">
542
+ <p class="signature " id="emit_end-instance_method">
543
+
544
+ - (<tt>Object</tt>) <strong>emit_end</strong>
545
+
546
+
547
+
548
+ </p><div class="docstring">
549
+ <div class="discussion">
550
+ <p>
551
+ Inserts an <% end %> directive before the oldest non-whitespace statement
552
+ possible.
553
+ </p>
554
+ <p>
555
+ Preceding lines that only emit whitespace are skipped.
556
+ </p>
557
+
558
+
559
+ </div>
560
+ </div>
561
+ <div class="tags">
562
+
563
+ </div><table class="source_code">
564
+ <tr>
565
+ <td>
566
+ <pre class="lines">
567
+
568
+
569
+ 500
570
+ 501
571
+ 502
572
+ 503
573
+ 504
574
+ 505
575
+ 506
576
+ 507
577
+ 508
578
+ 509
579
+ 510
580
+ 511
581
+ 512
582
+ 513
583
+ 514
584
+ 515
585
+ 516
586
+ 517
587
+ 518
588
+ 519
589
+ 520
590
+ 521
591
+ 522</pre>
592
+ </td>
593
+ <td>
594
+ <pre class="code"><span class="info file"># File 'lib/ember/template.rb', line 500</span>
595
+
596
+ <span class='kw'>def</span> <span class='id emit_end'>emit_end</span>
597
+ <span class='id ending'>ending</span> <span class='op'>=</span> <span class='const'>Statement</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='symbol'>:code</span><span class='comma'>,</span> <span class='symbol'>:end</span><span class='rparen'>)</span>
598
+ <span class='id current'>current</span> <span class='op'>=</span> <span class='id insertion_point'>insertion_point</span>
599
+
600
+ <span class='id can_skip_line'>can_skip_line</span> <span class='op'>=</span> <span class='id lambda'>lambda</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id line'>line</span><span class='op'>|</span>
601
+ <span class='id line'>line</span><span class='period'>.</span><span class='id empty?'>empty?</span> <span class='op'>||</span>
602
+ <span class='id line'>line</span><span class='period'>.</span><span class='id all?'>all?</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id stmt'>stmt</span><span class='op'>|</span> <span class='id stmt'>stmt</span><span class='period'>.</span><span class='id type'>type</span> <span class='op'>==</span> <span class='symbol'>:text</span> <span class='op'>&amp;&amp;</span> <span class='id stmt'>stmt</span><span class='period'>.</span><span class='id value'>value</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\A\s*\z</span><span class='regexp_end'>/</span></span> <span class='rbrace'>}</span>
603
+ <span class='kw'>end</span>
604
+
605
+ <span class='kw'>if</span> <span class='id can_skip_line'>can_skip_line</span><span class='lbracket'>[</span><span class='id current'>current</span><span class='rbracket'>]</span>
606
+ <span class='id target'>target</span> <span class='op'>=</span> <span class='id current'>current</span>
607
+
608
+ <span class='comment'># skip past empty whitespace in previous lines
609
+ </span> <span class='ivar'>@source_lines</span><span class='period'>.</span><span class='id reverse_each'>reverse_each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id line'>line</span><span class='op'>|</span>
610
+ <span class='kw'>break</span> <span class='kw'>unless</span> <span class='id can_skip_line'>can_skip_line</span><span class='lbracket'>[</span><span class='id line'>line</span><span class='rbracket'>]</span>
611
+ <span class='id target'>target</span> <span class='op'>=</span> <span class='id line'>line</span>
612
+ <span class='kw'>end</span>
613
+
614
+ <span class='id target'>target</span><span class='period'>.</span><span class='id unshift'>unshift</span> <span class='id ending'>ending</span>
615
+ <span class='kw'>else</span>
616
+ <span class='id current'>current</span><span class='period'>.</span><span class='id push'>push</span> <span class='id ending'>ending</span>
617
+ <span class='kw'>end</span>
618
+ <span class='kw'>end</span></pre>
619
+ </td>
620
+ </tr>
621
+ </table>
622
+ </div>
623
+
624
+ <div class="method_details ">
625
+ <p class="signature " id="emit_expr-instance_method">
626
+
627
+ - (<tt>Object</tt>) <strong>emit_expr</strong>(value)
628
+
629
+
630
+
631
+ </p><div class="docstring">
632
+ <div class="discussion">
633
+ <p>
634
+ Schedules the given Ruby code to be evaluated and inserted into the
635
+ evaluation buffer when this program is run.
636
+ </p>
637
+
638
+
639
+ </div>
640
+ </div>
641
+ <div class="tags">
642
+
643
+ </div><table class="source_code">
644
+ <tr>
645
+ <td>
646
+ <pre class="lines">
647
+
648
+
649
+ 490
650
+ 491
651
+ 492</pre>
652
+ </td>
653
+ <td>
654
+ <pre class="code"><span class="info file"># File 'lib/ember/template.rb', line 490</span>
655
+
656
+ <span class='kw'>def</span> <span class='id emit_expr'>emit_expr</span> <span class='id value'>value</span>
657
+ <span class='id statement'>statement</span> <span class='symbol'>:expr</span><span class='comma'>,</span> <span class='id value'>value</span>
658
+ <span class='kw'>end</span></pre>
659
+ </td>
660
+ </tr>
661
+ </table>
662
+ </div>
663
+
664
+ <div class="method_details ">
665
+ <p class="signature " id="emit_text-instance_method">
666
+
667
+ - (<tt>Object</tt>) <strong>emit_text</strong>(value)
668
+
669
+
670
+
671
+ </p><div class="docstring">
672
+ <div class="discussion">
673
+ <p>
674
+ Schedules the given text to be inserted verbatim into the evaluation buffer
675
+ when this program is run.
676
+ </p>
677
+
678
+
679
+ </div>
680
+ </div>
681
+ <div class="tags">
682
+
683
+ </div><table class="source_code">
684
+ <tr>
685
+ <td>
686
+ <pre class="lines">
687
+
688
+
689
+ 466
690
+ 467
691
+ 468
692
+ 469
693
+ 470
694
+ 471
695
+ 472
696
+ 473
697
+ 474
698
+ 475
699
+ 476</pre>
700
+ </td>
701
+ <td>
702
+ <pre class="code"><span class="info file"># File 'lib/ember/template.rb', line 466</span>
703
+
704
+ <span class='kw'>def</span> <span class='id emit_text'>emit_text</span> <span class='id value'>value</span>
705
+ <span class='comment'># don't bother emitting empty strings
706
+ </span> <span class='kw'>return</span> <span class='kw'>if</span> <span class='id value'>value</span><span class='period'>.</span><span class='id empty?'>empty?</span>
707
+
708
+ <span class='comment'># combine adjacent statements to reduce code size
709
+ </span> <span class='kw'>if</span> <span class='id prev'>prev</span> <span class='op'>=</span> <span class='id insertion_point'>insertion_point</span><span class='period'>.</span><span class='id last'>last</span> <span class='kw'>and</span> <span class='id prev'>prev</span><span class='period'>.</span><span class='id type'>type</span> <span class='op'>==</span> <span class='symbol'>:text</span>
710
+ <span class='id prev'>prev</span><span class='period'>.</span><span class='id value'>value</span> <span class='op'>&lt;&lt;</span> <span class='id value'>value</span>
711
+ <span class='kw'>else</span>
712
+ <span class='id statement'>statement</span> <span class='symbol'>:text</span><span class='comma'>,</span> <span class='id value'>value</span>
713
+ <span class='kw'>end</span>
714
+ <span class='kw'>end</span></pre>
715
+ </td>
716
+ </tr>
717
+ </table>
718
+ </div>
719
+
720
+ <div class="method_details ">
721
+ <p class="signature " id="empty?-instance_method">
722
+
723
+ - (<tt>Boolean</tt>) <strong>empty?</strong>
724
+
725
+
726
+
727
+ </p><div class="docstring">
728
+ <div class="discussion">
729
+ <p>
730
+ Returns true if there are no source lines in this program.
731
+ </p>
732
+
733
+
734
+ </div>
735
+ </div>
736
+ <div class="tags">
737
+ <h3>Returns:</h3>
738
+ <ul class="return">
739
+
740
+ <li>
741
+
742
+ <span class='type'>(<tt>Boolean</tt>)</span>
743
+
744
+
745
+
746
+
747
+ </li>
748
+
749
+ </ul>
750
+
751
+ </div><table class="source_code">
752
+ <tr>
753
+ <td>
754
+ <pre class="lines">
755
+
756
+
757
+ 442
758
+ 443
759
+ 444</pre>
760
+ </td>
761
+ <td>
762
+ <pre class="code"><span class="info file"># File 'lib/ember/template.rb', line 442</span>
763
+
764
+ <span class='kw'>def</span> <span class='id empty?'>empty?</span>
765
+ <span class='ivar'>@source_lines</span><span class='period'>.</span><span class='id empty?'>empty?</span>
766
+ <span class='kw'>end</span></pre>
767
+ </td>
768
+ </tr>
769
+ </table>
770
+ </div>
771
+
772
+ <div class="method_details ">
773
+ <p class="signature " id="new_line-instance_method">
774
+
775
+ - (<tt>Object</tt>) <strong>new_line</strong>
776
+
777
+
778
+
779
+ </p><div class="docstring">
780
+ <div class="discussion">
781
+ <p>
782
+ Begins a new line in the program&#8217;s source code.
783
+ </p>
784
+
785
+
786
+ </div>
787
+ </div>
788
+ <div class="tags">
789
+
790
+ </div><table class="source_code">
791
+ <tr>
792
+ <td>
793
+ <pre class="lines">
794
+
795
+
796
+ 449
797
+ 450
798
+ 451</pre>
799
+ </td>
800
+ <td>
801
+ <pre class="code"><span class="info file"># File 'lib/ember/template.rb', line 449</span>
802
+
803
+ <span class='kw'>def</span> <span class='id new_line'>new_line</span>
804
+ <span class='ivar'>@source_lines</span> <span class='op'>&lt;&lt;</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
805
+ <span class='kw'>end</span></pre>
806
+ </td>
807
+ </tr>
808
+ </table>
809
+ </div>
810
+
811
+ <div class="method_details ">
812
+ <p class="signature " id="new_line?-instance_method">
813
+
814
+ - (<tt>Boolean</tt>) <strong>new_line?</strong>
815
+
816
+
817
+
818
+ </p><div class="docstring">
819
+ <div class="discussion">
820
+ <p>
821
+ Returns true if a new (blank) line is ready in the program&#8217;s source
822
+ code.
823
+ </p>
824
+
825
+
826
+ </div>
827
+ </div>
828
+ <div class="tags">
829
+ <h3>Returns:</h3>
830
+ <ul class="return">
831
+
832
+ <li>
833
+
834
+ <span class='type'>(<tt>Boolean</tt>)</span>
835
+
836
+
837
+
838
+
839
+ </li>
840
+
841
+ </ul>
842
+
843
+ </div><table class="source_code">
844
+ <tr>
845
+ <td>
846
+ <pre class="lines">
847
+
848
+
849
+ 457
850
+ 458
851
+ 459
852
+ 460</pre>
853
+ </td>
854
+ <td>
855
+ <pre class="code"><span class="info file"># File 'lib/ember/template.rb', line 457</span>
856
+
857
+ <span class='kw'>def</span> <span class='id new_line?'>new_line?</span>
858
+ <span class='id ary'>ary</span> <span class='op'>=</span> <span class='id insertion_point'>insertion_point</span>
859
+ <span class='id ary'>ary</span><span class='period'>.</span><span class='id empty?'>empty?</span> <span class='op'>||</span> <span class='id ary'>ary</span><span class='period'>.</span><span class='id all?'>all?</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id stmt'>stmt</span><span class='op'>|</span> <span class='id stmt'>stmt</span><span class='period'>.</span><span class='id type'>type</span> <span class='op'>==</span> <span class='symbol'>:code</span> <span class='rbrace'>}</span>
860
+ <span class='kw'>end</span></pre>
861
+ </td>
862
+ </tr>
863
+ </table>
864
+ </div>
865
+
866
+ </div>
867
+
868
+ </div>
869
+
870
+ <div id="footer">
871
+ Generated on Sat Apr 3 14:23:18 2010 by
872
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
873
+ 0.5.4 (ruby-1.9.1).
874
+ </div>
875
+
876
+ </body>
877
+ </html>