ember 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,774 +0,0 @@
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</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 (T)</a> &raquo;
27
- <span class='title'><a href="../Ember.html" title="Ember (module)">Ember</a></span>
28
- &raquo;
29
- <span class="title">Template</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
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</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>Defined Under Namespace</h2>
82
- <p class="children">
83
-
84
-
85
-
86
-
87
- <strong class="classes">Classes:</strong> <a href="Template/Program.html" title="Ember::Template::Program (class)">Program</a>
88
-
89
-
90
- </p>
91
-
92
- <h2>Constant Summary</h2>
93
-
94
- <dl class="constants">
95
-
96
- <dt id="OPERATION_EVAL_EXPRESSION-constant" class="">OPERATION_EVAL_EXPRESSION =
97
-
98
- </dt>
99
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>=</span><span class='tstring_end'>'</span></span></pre></dd>
100
-
101
- <dt id="OPERATION_COMMENT_LINE-constant" class="">OPERATION_COMMENT_LINE =
102
-
103
- </dt>
104
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>#</span><span class='tstring_end'>'</span></span></pre></dd>
105
-
106
- <dt id="OPERATION_BEGIN_LAMBDA-constant" class="">OPERATION_BEGIN_LAMBDA =
107
-
108
- </dt>
109
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>|</span><span class='tstring_end'>'</span></span></pre></dd>
110
-
111
- <dt id="OPERATION_EVAL_TEMPLATE_FILE-constant" class="">OPERATION_EVAL_TEMPLATE_FILE =
112
-
113
- </dt>
114
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>+</span><span class='tstring_end'>'</span></span></pre></dd>
115
-
116
- <dt id="OPERATION_EVAL_TEMPLATE_STRING-constant" class="">OPERATION_EVAL_TEMPLATE_STRING =
117
-
118
- </dt>
119
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>~</span><span class='tstring_end'>'</span></span></pre></dd>
120
-
121
- <dt id="OPERATION_INSERT_PLAIN_FILE-constant" class="">OPERATION_INSERT_PLAIN_FILE =
122
-
123
- </dt>
124
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>&lt;</span><span class='tstring_end'>'</span></span></pre></dd>
125
-
126
- <dt id="OPERATIONS-constant" class="">OPERATIONS =
127
-
128
- </dt>
129
- <dd><pre class="code"><span class='lbracket'>[</span>
130
- <span class='const'>OPERATION_COMMENT_LINE</span><span class='comma'>,</span>
131
- <span class='const'>OPERATION_BEGIN_LAMBDA</span><span class='comma'>,</span>
132
- <span class='const'>OPERATION_EVAL_EXPRESSION</span><span class='comma'>,</span>
133
- <span class='const'>OPERATION_EVAL_TEMPLATE_FILE</span><span class='comma'>,</span>
134
- <span class='const'>OPERATION_EVAL_TEMPLATE_STRING</span><span class='comma'>,</span>
135
- <span class='const'>OPERATION_INSERT_PLAIN_FILE</span><span class='comma'>,</span>
136
- <span class='rbracket'>]</span></pre></dd>
137
-
138
- <dt id="SILENT_OPERATIONS-constant" class="">SILENT_OPERATIONS =
139
-
140
- </dt>
141
- <dd><pre class="code"><span class='lbracket'>[</span>
142
- <span class='const'>OPERATION_COMMENT_LINE</span><span class='comma'>,</span>
143
- <span class='const'>OPERATION_BEGIN_LAMBDA</span><span class='comma'>,</span>
144
- <span class='rbracket'>]</span></pre></dd>
145
-
146
- <dt id="VOCAL_OPERATIONS-constant" class="">VOCAL_OPERATIONS =
147
-
148
- </dt>
149
- <dd><pre class="code"><span class='const'>OPERATIONS</span> <span class='op'>-</span> <span class='const'>SILENT_OPERATIONS</span></pre></dd>
150
-
151
- <dt id="DIRECTIVE_HEAD-constant" class="">DIRECTIVE_HEAD =
152
-
153
- </dt>
154
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>&lt;%</span><span class='tstring_end'>'</span></span></pre></dd>
155
-
156
- <dt id="DIRECTIVE_BODY-constant" class="">DIRECTIVE_BODY =
157
-
158
- </dt>
159
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>(?:(?#
160
- there is nothing here, before the alternation,
161
- because we want to match the &quot;&lt;%%&gt;&quot; base case
162
- </span><span class='tstring_content'>)|[^%](?:.(?!&lt;%))*?)</span><span class='tstring_end'>'</span></span></pre></dd>
163
-
164
- <dt id="DIRECTIVE_TAIL-constant" class="">DIRECTIVE_TAIL =
165
-
166
- </dt>
167
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-?%&gt;</span><span class='tstring_end'>'</span></span></pre></dd>
168
-
169
- <dt id="SHORTHAND_HEAD-constant" class="">SHORTHAND_HEAD =
170
-
171
- </dt>
172
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%</span><span class='tstring_end'>'</span></span></pre></dd>
173
-
174
- <dt id="SHORTHAND_BODY-constant" class="">SHORTHAND_BODY =
175
-
176
- </dt>
177
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>(?:(?#
178
- there is nothing here, before the alternation,
179
- because we want to match the &quot;&lt;%%&gt;&quot; base case
180
- </span><span class='tstring_content'>)|[^%].*)</span><span class='tstring_end'>'</span></span></pre></dd>
181
-
182
- <dt id="SHORTHAND_TAIL-constant" class="">SHORTHAND_TAIL =
183
-
184
- </dt>
185
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>$</span><span class='tstring_end'>'</span></span></pre></dd>
186
-
187
- <dt id="NEWLINE-constant" class="">NEWLINE =
188
-
189
- </dt>
190
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>\r?\n</span><span class='tstring_end'>'</span></span></pre></dd>
191
-
192
- <dt id="SPACING-constant" class="">SPACING =
193
-
194
- </dt>
195
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>[[:blank:]]*</span><span class='tstring_end'>'</span></span></pre></dd>
196
-
197
- <dt id="MARGIN_REGEXP-constant" class="">MARGIN_REGEXP =
198
-
199
- </dt>
200
- <dd><pre class="code"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^</span><span class='embexpr_beg'>#{</span><span class='const'>SPACING</span><span class='rbrace'>}</span><span class='tstring_content'>(?=\S)</span><span class='regexp_end'>/o</span></span></pre></dd>
201
-
202
- <dt id="LAMBDA_BEGIN_REGEXP-constant" class="">LAMBDA_BEGIN_REGEXP =
203
-
204
- </dt>
205
- <dd><pre class="code"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\b(do)\b\s*(\|.*?\|)?\s*$</span><span class='regexp_end'>/</span></span></pre></dd>
206
-
207
- <dt id="BLOCK_BEGIN_REGEXP-constant" class="">BLOCK_BEGIN_REGEXP =
208
-
209
- </dt>
210
- <dd><pre class="code"><span class='id build_keyword_regexp'>build_keyword_regexp</span><span class='lbracket'>[</span>
211
- <span class='comment'># generic
212
- </span> <span class='symbol'>:begin</span><span class='comma'>,</span>
213
-
214
- <span class='comment'># conditional
215
- </span> <span class='symbol'>:if</span><span class='comma'>,</span> <span class='symbol'>:unless</span><span class='comma'>,</span> <span class='symbol'>:case</span><span class='comma'>,</span>
216
-
217
- <span class='comment'># loops
218
- </span> <span class='symbol'>:for</span><span class='comma'>,</span> <span class='symbol'>:while</span><span class='comma'>,</span> <span class='symbol'>:until</span><span class='comma'>,</span>
219
-
220
- <span class='comment'># scopes
221
- </span> <span class='symbol'>:def</span><span class='comma'>,</span> <span class='symbol'>:class</span><span class='comma'>,</span> <span class='symbol'>:module</span>
222
- <span class='rbracket'>]</span></pre></dd>
223
-
224
- <dt id="BLOCK_CONTINUE_REGEXP-constant" class="">BLOCK_CONTINUE_REGEXP =
225
-
226
- </dt>
227
- <dd><pre class="code"><span class='id build_keyword_regexp'>build_keyword_regexp</span><span class='lbracket'>[</span>
228
- <span class='comment'># generic
229
- </span> <span class='symbol'>:rescue</span><span class='comma'>,</span> <span class='symbol'>:ensure</span><span class='comma'>,</span>
230
-
231
- <span class='comment'># conditional
232
- </span> <span class='symbol'>:else</span><span class='comma'>,</span> <span class='symbol'>:elsif</span><span class='comma'>,</span> <span class='symbol'>:when</span>
233
- <span class='rbracket'>]</span></pre></dd>
234
-
235
- <dt id="BLOCK_END_REGEXP-constant" class="">BLOCK_END_REGEXP =
236
-
237
- </dt>
238
- <dd><pre class="code"><span class='id build_keyword_regexp'>build_keyword_regexp</span><span class='lbracket'>[</span>
239
- <span class='comment'># generic
240
- </span> <span class='symbol'>:end</span>
241
- <span class='rbracket'>]</span></pre></dd>
242
-
243
- <dt id="contexts-classvariable" class="">@@contexts =
244
-
245
- </dt>
246
- <dd><pre class="code"><span class='lbrace'>{</span><span class='rbrace'>}</span></pre></dd>
247
-
248
- </dl>
249
-
250
-
251
-
252
-
253
-
254
- <h2>Class Method Summary</h2>
255
-
256
- <ul class="summary">
257
-
258
- <li class="public ">
259
- <span class="summary_signature">
260
-
261
- <a href="#load_file-class_method" title="load_file (class method)">+ (Object) <strong>load_file</strong>(path, options = {}) </a>
262
-
263
-
264
-
265
- </span>
266
-
267
-
268
-
269
-
270
-
271
-
272
-
273
- <span class="summary_desc"><div class='inline'><p>
274
- Builds a template whose body is read from the given source.
275
- </p>
276
- </div></span>
277
-
278
- </li>
279
-
280
-
281
- <li class="public ">
282
- <span class="summary_signature">
283
-
284
- <a href="#read_file-class_method" title="read_file (class method)">+ (Object) <strong>read_file</strong>(path, options = {}) </a>
285
-
286
-
287
-
288
- </span>
289
-
290
-
291
-
292
-
293
-
294
-
295
-
296
- <span class="summary_desc"><div class='inline'><p>
297
- Returns the contents of the given file, which can be relative to the
298
- current template in which this command is being executed.
299
- </p>
300
- </div></span>
301
-
302
- </li>
303
-
304
-
305
- </ul>
306
-
307
- <h2>Instance Method Summary</h2>
308
-
309
- <ul class="summary">
310
-
311
- <li class="public ">
312
- <span class="summary_signature">
313
-
314
- <a href="#initialize-instance_method" title="#initialize (instance method)">- (Template) <strong>initialize</strong>(input, options = {}) </a>
315
-
316
-
317
-
318
- </span>
319
-
320
- <span class="note title constructor">constructor</span>
321
-
322
-
323
-
324
-
325
-
326
-
327
-
328
- <span class="summary_desc"><div class='inline'><p>
329
- Builds a processor that evaluates eRuby directives in the given input
330
- according to the given options.
331
- </p>
332
- </div></span>
333
-
334
- </li>
335
-
336
-
337
- <li class="public ">
338
- <span class="summary_signature">
339
-
340
- <a href="#program-instance_method" title="#program (instance method)">- (Object) <strong>program</strong> </a>
341
-
342
-
343
-
344
- </span>
345
-
346
-
347
-
348
-
349
-
350
-
351
-
352
- <span class="summary_desc"><div class='inline'><p>
353
- Ruby source code assembled from the eRuby template provided as input to the
354
- constructor of this class.
355
- </p>
356
- </div></span>
357
-
358
- </li>
359
-
360
-
361
- <li class="public ">
362
- <span class="summary_signature">
363
-
364
- <a href="#render-instance_method" title="#render (instance method)">- (Object) <strong>render</strong>(context = TOPLEVEL_BINDING, parent_context_id = nil) </a>
365
-
366
-
367
-
368
- </span>
369
-
370
-
371
-
372
-
373
-
374
-
375
-
376
- <span class="summary_desc"><div class='inline'><p>
377
- Returns the result of executing the Ruby program for this template
378
- (provided by the <tt><a href="#program-instance_method" title="Ember::Template#program (method)">#program</a></tt> method) inside the given context binding.
379
- </p>
380
- </div></span>
381
-
382
- </li>
383
-
384
-
385
- </ul>
386
-
387
-
388
- <div id="constructor_details" class="method_details_list">
389
- <h2>Constructor Details</h2>
390
-
391
- <div class="method_details first">
392
- <p class="signature first" id="initialize-instance_method">
393
-
394
- - (<tt><a href="" title="Ember::Template (class)">Template</a></tt>) <strong>initialize</strong>(input, options = {})
395
-
396
-
397
-
398
- </p><div class="docstring">
399
- <div class="discussion">
400
- <p>
401
- Builds a processor that evaluates eRuby directives in the given input
402
- according to the given options.
403
- </p>
404
- <p>
405
- This processor transforms the given input into an executable Ruby program
406
- (provided by the <tt><a href="#program-instance_method" title="Ember::Template#program (method)">#program</a></tt> method) which is then executed by the <tt><a href="#render-instance_method" title="Ember::Template#render (method)">#render</a></tt>
407
- method on demand.
408
- </p>
409
- <p>
410
- eRuby directives that contribute to the output of the given template are
411
- called &#8220;vocal&#8221; directives. Those that do not are called
412
- &#8220;silent&#8221; directives.
413
- </p>
414
-
415
-
416
- </div>
417
- </div>
418
- <div class="tags">
419
-
420
-
421
-
422
-
423
-
424
-
425
- <h3>Options Hash (<tt>options</tt>):</h3>
426
- <ul class="option">
427
-
428
- <li>
429
- <span class="type">(<tt>String</tt>)</span>
430
- <span class="name">:result_variable</span>
431
- <span class="default">
432
-
433
- &mdash; default:
434
- <tt>&quot;_erbout&quot;</tt>
435
-
436
- </span>
437
- &mdash;<div class='inline'><p>
438
- Name of the variable which stores the result of template evaluation during
439
- template evaluation.
440
- </p>
441
- </div>
442
- </tr>
443
-
444
- <li>
445
- <span class="type">(<tt>Boolean</tt>)</span>
446
- <span class="name">:continue_result</span>
447
- <span class="default">
448
-
449
- &mdash; default:
450
- <tt>false</tt>
451
-
452
- </span>
453
- &mdash;<div class='inline'><p>
454
- Append to the result variable if it already exists?
455
- </p>
456
- </div>
457
- </tr>
458
-
459
- <li>
460
- <span class="type">(<tt>String</tt>)</span>
461
- <span class="name">:source_file</span>
462
- <span class="default">
463
-
464
- &mdash; default:
465
- <tt>&quot;SOURCE&quot;</tt>
466
-
467
- </span>
468
- &mdash;<div class='inline'><p>
469
- Name of the file which contains the given input. This is shown in stack
470
- traces when reporting error messages.
471
- </p>
472
- </div>
473
- </tr>
474
-
475
- <li>
476
- <span class="type">(<tt>Integer</tt>)</span>
477
- <span class="name">:source_line</span>
478
- <span class="default">
479
-
480
- &mdash; default:
481
- <tt>1</tt>
482
-
483
- </span>
484
- &mdash;<div class='inline'><p>
485
- Line number at which the given input exists in the :source_file. This is
486
- shown in stack traces when reporting error messages.
487
- </p>
488
- </div>
489
- </tr>
490
-
491
- <li>
492
- <span class="type">(<tt>Boolean</tt>)</span>
493
- <span class="name">:shorthand</span>
494
- <span class="default">
495
-
496
- &mdash; default:
497
- <tt>false</tt>
498
-
499
- </span>
500
- &mdash;<div class='inline'><p>
501
- Treat lines beginning with &#8220;%&#8221; as eRuby directives?
502
- </p>
503
- </div>
504
- </tr>
505
-
506
- <li>
507
- <span class="type">(<tt>Boolean</tt>)</span>
508
- <span class="name">:infer_end</span>
509
- <span class="default">
510
-
511
- &mdash; default:
512
- <tt>false</tt>
513
-
514
- </span>
515
- &mdash;<div class='inline'><p>
516
- Add missing <tt>&lt;% end %&gt;</tt> statements based on indentation?
517
- </p>
518
- </div>
519
- </tr>
520
-
521
- <li>
522
- <span class="type">(<tt>Boolean</tt>)</span>
523
- <span class="name">:unindent</span>
524
- <span class="default">
525
-
526
- &mdash; default:
527
- <tt>false</tt>
528
-
529
- </span>
530
- &mdash;<div class='inline'><p>
531
- Unindent the content of eRuby blocks--that is everything between the
532
- <tt>&lt;% do %&gt;</tt> and <tt>&lt;% end %&gt;</tt> tags--hierarchically?
533
- </p>
534
- </div>
535
- </tr>
536
-
537
- </ul>
538
-
539
-
540
- </div><table class="source_code">
541
- <tr>
542
- <td>
543
- <pre class="lines">
544
-
545
-
546
- 50
547
- 51
548
- 52
549
- 53
550
- 54</pre>
551
- </td>
552
- <td>
553
- <pre class="code"><span class="info file"># File 'lib/ember/template.rb', line 50</span>
554
-
555
- <span class='kw'>def</span> <span class='id initialize'>initialize</span> <span class='id input'>input</span><span class='comma'>,</span> <span class='id options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
556
- <span class='ivar'>@options</span> <span class='op'>=</span> <span class='id options'>options</span>
557
- <span class='ivar'>@render_context_id</span> <span class='op'>=</span> <span class='id object_id'>object_id</span>
558
- <span class='ivar'>@compile</span> <span class='op'>=</span> <span class='id compile'>compile</span><span class='lparen'>(</span><span class='id input'>input</span><span class='period'>.</span><span class='id to_s'>to_s</span><span class='rparen'>)</span>
559
- <span class='kw'>end</span></pre>
560
- </td>
561
- </tr>
562
- </table>
563
- </div>
564
-
565
- </div>
566
-
567
-
568
- <div id="class_method_details" class="method_details_list">
569
- <h2>Class Method Details</h2>
570
-
571
-
572
- <div class="method_details first">
573
- <p class="signature first" id="load_file-class_method">
574
-
575
- + (<tt>Object</tt>) <strong>load_file</strong>(path, options = {})
576
-
577
-
578
-
579
- </p><div class="docstring">
580
- <div class="discussion">
581
- <p>
582
- Builds a template whose body is read from the given source.
583
- </p>
584
- <p>
585
- If the source is a relative path, it will be resolved relative to
586
- options[:source_file] if that is a valid path.
587
- </p>
588
-
589
-
590
- </div>
591
- </div>
592
- <div class="tags">
593
-
594
- </div><table class="source_code">
595
- <tr>
596
- <td>
597
- <pre class="lines">
598
-
599
-
600
- 89
601
- 90
602
- 91
603
- 92</pre>
604
- </td>
605
- <td>
606
- <pre class="code"><span class="info file"># File 'lib/ember/template.rb', line 89</span>
607
-
608
- <span class='kw'>def</span> <span class='id load_file'>load_file</span> <span class='id path'>path</span><span class='comma'>,</span> <span class='id options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
609
- <span class='id path'>path</span> <span class='op'>=</span> <span class='id resolve_path'>resolve_path</span><span class='lparen'>(</span><span class='id path'>path</span><span class='comma'>,</span> <span class='id options'>options</span><span class='rparen'>)</span>
610
- <span class='id new'>new</span> <span class='const'>File</span><span class='period'>.</span><span class='id read'>read</span><span class='lparen'>(</span><span class='id path'>path</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id options'>options</span><span class='period'>.</span><span class='id merge'>merge</span><span class='lparen'>(</span><span class='symbol'>:source_file</span> <span class='op'>=&gt;</span> <span class='id path'>path</span><span class='rparen'>)</span>
611
- <span class='kw'>end</span></pre>
612
- </td>
613
- </tr>
614
- </table>
615
- </div>
616
-
617
- <div class="method_details ">
618
- <p class="signature " id="read_file-class_method">
619
-
620
- + (<tt>Object</tt>) <strong>read_file</strong>(path, options = {})
621
-
622
-
623
-
624
- </p><div class="docstring">
625
- <div class="discussion">
626
- <p>
627
- Returns the contents of the given file, which can be relative to the
628
- current template in which this command is being executed.
629
- </p>
630
- <p>
631
- If the source is a relative path, it will be resolved relative to
632
- options[:source_file] if that is a valid path.
633
- </p>
634
-
635
-
636
- </div>
637
- </div>
638
- <div class="tags">
639
-
640
- </div><table class="source_code">
641
- <tr>
642
- <td>
643
- <pre class="lines">
644
-
645
-
646
- 101
647
- 102
648
- 103</pre>
649
- </td>
650
- <td>
651
- <pre class="code"><span class="info file"># File 'lib/ember/template.rb', line 101</span>
652
-
653
- <span class='kw'>def</span> <span class='id read_file'>read_file</span> <span class='id path'>path</span><span class='comma'>,</span> <span class='id options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
654
- <span class='const'>File</span><span class='period'>.</span><span class='id read'>read</span> <span class='id resolve_path'>resolve_path</span><span class='lparen'>(</span><span class='id path'>path</span><span class='comma'>,</span> <span class='id options'>options</span><span class='rparen'>)</span>
655
- <span class='kw'>end</span></pre>
656
- </td>
657
- </tr>
658
- </table>
659
- </div>
660
-
661
- </div>
662
-
663
- <div id="instance_method_details" class="method_details_list">
664
- <h2>Instance Method Details</h2>
665
-
666
-
667
- <div class="method_details first">
668
- <p class="signature first" id="program-instance_method">
669
-
670
- - (<tt>Object</tt>) <strong>program</strong>
671
-
672
-
673
-
674
- </p><div class="docstring">
675
- <div class="discussion">
676
- <p>
677
- Ruby source code assembled from the eRuby template provided as input to the
678
- constructor of this class.
679
- </p>
680
-
681
-
682
- </div>
683
- </div>
684
- <div class="tags">
685
-
686
- </div><table class="source_code">
687
- <tr>
688
- <td>
689
- <pre class="lines">
690
-
691
-
692
- 60
693
- 61
694
- 62</pre>
695
- </td>
696
- <td>
697
- <pre class="code"><span class="info file"># File 'lib/ember/template.rb', line 60</span>
698
-
699
- <span class='kw'>def</span> <span class='id program'>program</span>
700
- <span class='ivar'>@compile</span>
701
- <span class='kw'>end</span></pre>
702
- </td>
703
- </tr>
704
- </table>
705
- </div>
706
-
707
- <div class="method_details ">
708
- <p class="signature " id="render-instance_method">
709
-
710
- - (<tt>Object</tt>) <strong>render</strong>(context = TOPLEVEL_BINDING, parent_context_id = nil)
711
-
712
-
713
-
714
- </p><div class="docstring">
715
- <div class="discussion">
716
- <p>
717
- Returns the result of executing the Ruby program for this template
718
- (provided by the <tt><a href="#program-instance_method" title="Ember::Template#program (method)">#program</a></tt> method) inside the given context binding.
719
- </p>
720
-
721
-
722
- </div>
723
- </div>
724
- <div class="tags">
725
-
726
- </div><table class="source_code">
727
- <tr>
728
- <td>
729
- <pre class="lines">
730
-
731
-
732
- 70
733
- 71
734
- 72
735
- 73
736
- 74
737
- 75
738
- 76
739
- 77
740
- 78
741
- 79
742
- 80</pre>
743
- </td>
744
- <td>
745
- <pre class="code"><span class="info file"># File 'lib/ember/template.rb', line 70</span>
746
-
747
- <span class='kw'>def</span> <span class='id render'>render</span> <span class='id context'>context</span> <span class='op'>=</span> <span class='const'>TOPLEVEL_BINDING</span><span class='comma'>,</span> <span class='id parent_context_id'>parent_context_id</span> <span class='op'>=</span> <span class='kw'>nil</span>
748
- <span class='id context'>context</span> <span class='op'>||=</span> <span class='cvar'>@@contexts</span><span class='lbracket'>[</span><span class='id parent_context_id'>parent_context_id</span><span class='rbracket'>]</span> <span class='comment'># inherit parent context
749
- </span> <span class='cvar'>@@contexts</span><span class='lbracket'>[</span><span class='ivar'>@render_context_id</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id context'>context</span> <span class='comment'># provide to children
750
- </span>
751
- <span class='id result'>result</span> <span class='op'>=</span> <span class='id eval'>eval</span> <span class='ivar'>@compile</span><span class='comma'>,</span> <span class='id context'>context</span><span class='comma'>,</span>
752
- <span class='lparen'>(</span><span class='ivar'>@options</span><span class='lbracket'>[</span><span class='symbol'>:source_file</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='symbol'>:SOURCE</span><span class='rparen'>)</span><span class='period'>.</span><span class='id to_s'>to_s</span><span class='comma'>,</span>
753
- <span class='lparen'>(</span><span class='ivar'>@options</span><span class='lbracket'>[</span><span class='symbol'>:source_line</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='int'>1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id to_i'>to_i</span>
754
-
755
- <span class='cvar'>@@contexts</span><span class='period'>.</span><span class='id delete'>delete</span> <span class='ivar'>@render_context_id</span> <span class='comment'># free the memory
756
- </span> <span class='id result'>result</span>
757
- <span class='kw'>end</span></pre>
758
- </td>
759
- </tr>
760
- </table>
761
- </div>
762
-
763
- </div>
764
-
765
- </div>
766
-
767
- <div id="footer">
768
- Generated on Sat Apr 3 14:23:18 2010 by
769
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
770
- 0.5.4 (ruby-1.9.1).
771
- </div>
772
-
773
- </body>
774
- </html>