wee 0.3.1 → 0.4.0

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.
Files changed (92) hide show
  1. data/README +0 -1
  2. data/Rakefile +5 -0
  3. data/TODO +6 -0
  4. data/doc/rdoc/classes/Enumerable.html +6 -6
  5. data/doc/rdoc/classes/Wee/AnswerDecoration.html +10 -10
  6. data/doc/rdoc/classes/Wee/Application.html +110 -52
  7. data/doc/rdoc/classes/Wee/Brush/ActionCallbackMixin.html +8 -15
  8. data/doc/rdoc/classes/Wee/Brush/ActionURLCallbackMixin.html +8 -19
  9. data/doc/rdoc/classes/Wee/Brush/AnchorTag.html +22 -22
  10. data/doc/rdoc/classes/Wee/Brush/FileUploadTag.html +156 -0
  11. data/doc/rdoc/classes/Wee/Brush/FormTag.html +50 -25
  12. data/doc/rdoc/classes/Wee/Brush/GenericEncodedTextBrush.html +12 -12
  13. data/doc/rdoc/classes/Wee/Brush/GenericTagBrush.html +36 -36
  14. data/doc/rdoc/classes/Wee/Brush/GenericTextBrush.html +12 -12
  15. data/doc/rdoc/classes/Wee/Brush/ImageButtonTag.html +16 -16
  16. data/doc/rdoc/classes/Wee/Brush/InputCallbackMixin.html +8 -15
  17. data/doc/rdoc/classes/Wee/Brush/InputTag.html +12 -12
  18. data/doc/rdoc/classes/Wee/Brush/Page.html +14 -14
  19. data/doc/rdoc/classes/Wee/Brush/SelectListTag.html +28 -28
  20. data/doc/rdoc/classes/Wee/Brush/SelectOptionTag.html +14 -14
  21. data/doc/rdoc/classes/Wee/Brush/SubmitButtonTag.html +7 -7
  22. data/doc/rdoc/classes/Wee/Brush/TableDataTag.html +14 -14
  23. data/doc/rdoc/classes/Wee/Brush/TableHeaderTag.html +7 -7
  24. data/doc/rdoc/classes/Wee/Brush/TableRowTag.html +36 -36
  25. data/doc/rdoc/classes/Wee/Brush/TableTag.html +6 -6
  26. data/doc/rdoc/classes/Wee/Brush/TextAreaTag.html +28 -28
  27. data/doc/rdoc/classes/Wee/Brush/TextInputTag.html +7 -7
  28. data/doc/rdoc/classes/Wee/Brush.html +19 -19
  29. data/doc/rdoc/classes/Wee/CallbackRegistry.html +33 -33
  30. data/doc/rdoc/classes/Wee/CallbackStream.html +18 -18
  31. data/doc/rdoc/classes/Wee/Canvas.html +24 -24
  32. data/doc/rdoc/classes/Wee/Component.html +163 -138
  33. data/doc/rdoc/classes/Wee/Decoration.html +72 -41
  34. data/doc/rdoc/classes/Wee/Delegate.html +31 -31
  35. data/doc/rdoc/classes/Wee/ErrorResponse.html +12 -12
  36. data/doc/rdoc/classes/Wee/GenericResponse.html +6 -6
  37. data/doc/rdoc/classes/Wee/Helper.html +148 -0
  38. data/doc/rdoc/classes/Wee/HtmlCanvas.html +267 -166
  39. data/doc/rdoc/classes/Wee/HtmlWriter.html +40 -40
  40. data/doc/rdoc/classes/Wee/LiteralMethodCallback.html +12 -12
  41. data/doc/rdoc/classes/Wee/PageDecoration.html +199 -0
  42. data/doc/rdoc/classes/Wee/Presenter.html +69 -69
  43. data/doc/rdoc/classes/Wee/RedirectResponse.html +6 -6
  44. data/doc/rdoc/classes/Wee/RefreshResponse.html +6 -6
  45. data/doc/rdoc/classes/Wee/Request.html +18 -18
  46. data/doc/rdoc/classes/Wee/RequestHandler.html +32 -31
  47. data/doc/rdoc/classes/Wee/Response.html +24 -24
  48. data/doc/rdoc/classes/Wee/Session.html +83 -64
  49. data/doc/rdoc/classes/Wee/SimpleIdGenerator.html +18 -18
  50. data/doc/rdoc/classes/Wee/Snapshot.html +19 -19
  51. data/doc/rdoc/classes/Wee/Utils/LRUCache.html +6 -6
  52. data/doc/rdoc/classes/Wee/ValueHolder.html +18 -18
  53. data/doc/rdoc/classes/Wee/WEBrickAdaptor.html +66 -62
  54. data/doc/rdoc/classes/Wee.html +63 -2
  55. data/doc/rdoc/created.rid +1 -1
  56. data/doc/rdoc/files/README.html +6 -9
  57. data/doc/rdoc/files/lib/wee/adaptors/webrick_rb.html +1 -1
  58. data/doc/rdoc/files/lib/wee/application_rb.html +1 -1
  59. data/doc/rdoc/files/lib/wee/components/page_decoration_rb.html +101 -0
  60. data/doc/rdoc/files/lib/wee/components_rb.html +108 -0
  61. data/doc/rdoc/files/lib/wee/core/callback_rb.html +1 -1
  62. data/doc/rdoc/files/lib/wee/core/component_rb.html +1 -1
  63. data/doc/rdoc/files/lib/wee/core/decoration_rb.html +1 -1
  64. data/doc/rdoc/files/lib/wee/core_rb.html +3 -3
  65. data/doc/rdoc/files/lib/wee/renderer/html/brushes_rb.html +1 -1
  66. data/doc/rdoc/files/lib/wee/renderer/html/canvas_rb.html +1 -1
  67. data/doc/rdoc/files/lib/wee/requesthandler_rb.html +1 -1
  68. data/doc/rdoc/files/lib/wee/session_rb.html +2 -1
  69. data/doc/rdoc/files/lib/wee/utils/autoreload_rb.html +101 -0
  70. data/doc/rdoc/files/lib/wee/utils/helper_rb.html +108 -0
  71. data/doc/rdoc/files/lib/wee_rb.html +2 -1
  72. data/doc/rdoc/fr_class_index.html +3 -1
  73. data/doc/rdoc/fr_file_index.html +4 -0
  74. data/doc/rdoc/fr_method_index.html +203 -191
  75. data/examples/example.rb +2 -16
  76. data/examples/test.rb +15 -18
  77. data/lib/wee/adaptors/webrick.rb +3 -1
  78. data/lib/wee/application.rb +55 -19
  79. data/lib/wee/components/page_decoration.rb +14 -0
  80. data/lib/wee/components.rb +1 -0
  81. data/lib/wee/core/callback.rb +1 -1
  82. data/lib/wee/core/component.rb +27 -3
  83. data/lib/wee/core/decoration.rb +9 -0
  84. data/lib/wee/renderer/html/brushes.rb +21 -23
  85. data/lib/wee/renderer/html/canvas.rb +25 -4
  86. data/lib/wee/requesthandler.rb +1 -0
  87. data/lib/wee/session.rb +21 -1
  88. data/lib/wee/utils/autoreload.rb +27 -0
  89. data/lib/wee/utils/helper.rb +15 -0
  90. data/lib/wee.rb +2 -1
  91. metadata +203 -191
  92. data/test/components/page_decoration.rb +0 -7
@@ -83,7 +83,7 @@
83
83
  <div id="description">
84
84
  <p>
85
85
  The base class of all components. You should at least overwrite method <a
86
- href="Component.html#M000164">render</a> in your own subclasses.
86
+ href="Component.html#M000173">render</a> in your own subclasses.
87
87
  </p>
88
88
 
89
89
  </div>
@@ -92,13 +92,13 @@ href="Component.html#M000164">render</a> in your own subclasses.
92
92
  <div id="contents-list">
93
93
  <h3 class="section-bar">Contents</h3>
94
94
  <ul>
95
- <li><a href="#SEC00063">Render</a></li>
96
- <li><a href="#SEC00064">Callback</a></li>
97
- <li><a href="#SEC00065">Init</a></li>
98
- <li><a href="#SEC00066">Children</a></li>
99
- <li><a href="#SEC00067">Decoration</a></li>
100
- <li><a href="#SEC00068">Backtrack</a></li>
101
- <li><a href="#SEC00069">Call/Answer</a></li>
95
+ <li><a href="#SEC00067">Render</a></li>
96
+ <li><a href="#SEC00068">Callback</a></li>
97
+ <li><a href="#SEC00069">Init</a></li>
98
+ <li><a href="#SEC00070">Children</a></li>
99
+ <li><a href="#SEC00071">Decoration</a></li>
100
+ <li><a href="#SEC00072">Backtrack</a></li>
101
+ <li><a href="#SEC00073">Call/Answer</a></li>
102
102
  </ul>
103
103
  </div>
104
104
 
@@ -106,23 +106,23 @@ href="Component.html#M000164">render</a> in your own subclasses.
106
106
  <h3 class="section-bar">Methods</h3>
107
107
 
108
108
  <div class="name-list">
109
- <a href="#M000169">add_child</a>&nbsp;&nbsp;
110
- <a href="#M000173">add_decoration</a>&nbsp;&nbsp;
111
- <a href="#M000179">answer</a>&nbsp;&nbsp;
112
- <a href="#M000177">backtrack_state</a>&nbsp;&nbsp;
113
- <a href="#M000176">backtrack_state_chain</a>&nbsp;&nbsp;
114
- <a href="#M000178">call</a>&nbsp;&nbsp;
115
- <a href="#M000168">children</a>&nbsp;&nbsp;
116
- <a href="#M000170">decoration</a>&nbsp;&nbsp;
117
- <a href="#M000171">decoration=</a>&nbsp;&nbsp;
118
- <a href="#M000163">do_render_chain</a>&nbsp;&nbsp;
119
- <a href="#M000172">each_decoration</a>&nbsp;&nbsp;
120
- <a href="#M000167">initialize</a>&nbsp;&nbsp;
121
- <a href="#M000166">process_callbacks</a>&nbsp;&nbsp;
122
- <a href="#M000165">process_callbacks_chain</a>&nbsp;&nbsp;
123
- <a href="#M000174">remove_decoration</a>&nbsp;&nbsp;
124
- <a href="#M000175">remove_decoration_if</a>&nbsp;&nbsp;
125
- <a href="#M000164">render</a>&nbsp;&nbsp;
109
+ <a href="#M000178">add_child</a>&nbsp;&nbsp;
110
+ <a href="#M000182">add_decoration</a>&nbsp;&nbsp;
111
+ <a href="#M000188">answer</a>&nbsp;&nbsp;
112
+ <a href="#M000186">backtrack_state</a>&nbsp;&nbsp;
113
+ <a href="#M000185">backtrack_state_chain</a>&nbsp;&nbsp;
114
+ <a href="#M000187">call</a>&nbsp;&nbsp;
115
+ <a href="#M000177">children</a>&nbsp;&nbsp;
116
+ <a href="#M000179">decoration</a>&nbsp;&nbsp;
117
+ <a href="#M000180">decoration=</a>&nbsp;&nbsp;
118
+ <a href="#M000172">do_render_chain</a>&nbsp;&nbsp;
119
+ <a href="#M000181">each_decoration</a>&nbsp;&nbsp;
120
+ <a href="#M000176">initialize</a>&nbsp;&nbsp;
121
+ <a href="#M000175">process_callbacks</a>&nbsp;&nbsp;
122
+ <a href="#M000174">process_callbacks_chain</a>&nbsp;&nbsp;
123
+ <a href="#M000183">remove_decoration</a>&nbsp;&nbsp;
124
+ <a href="#M000184">remove_decoration_if</a>&nbsp;&nbsp;
125
+ <a href="#M000173">render</a>&nbsp;&nbsp;
126
126
  </div>
127
127
  </div>
128
128
 
@@ -142,7 +142,7 @@ href="Component.html#M000164">render</a> in your own subclasses.
142
142
 
143
143
  <!-- if method_list -->
144
144
  <div id="section">
145
- <h2 class="section-title"><a name="SEC00063">Render</a></h2>
145
+ <h2 class="section-title"><a name="SEC00067">Render</a></h2>
146
146
  <div class="section-comment">
147
147
 
148
148
  </div>
@@ -158,11 +158,11 @@ href="Component.html#M000164">render</a> in your own subclasses.
158
158
  <div id="methods">
159
159
  <h3 class="section-bar">Public Instance methods</h3>
160
160
 
161
- <div id="method-M000163" class="method-detail">
162
- <a name="M000163"></a>
161
+ <div id="method-M000172" class="method-detail">
162
+ <a name="M000172"></a>
163
163
 
164
164
  <div class="method-heading">
165
- <a href="#M000163" class="method-signature">
165
+ <a href="#M000172" class="method-signature">
166
166
  <span class="method-name">do_render_chain</span><span class="method-args">(rendering_context)</span>
167
167
  </a>
168
168
  </div>
@@ -170,7 +170,7 @@ href="Component.html#M000164">render</a> in your own subclasses.
170
170
  <div class="method-description">
171
171
  <p>
172
172
  Starts rendering the decoration chain by calling method <a
173
- href="Presenter.html#M000182">Presenter#do_render</a> for the first
173
+ href="Presenter.html#M000191">Presenter#do_render</a> for the first
174
174
  decoration of the component, or calling <em>do_render</em> for the
175
175
  component itself if no decorations were specified.
176
176
  </p>
@@ -180,8 +180,8 @@ component itself if no decorations were specified.
180
180
  </dd>
181
181
  </dl>
182
182
  <p><a class="source-toggle" href="#"
183
- onclick="toggleCode('M000163-source');return false;">[Source]</a></p>
184
- <div class="method-source-code" id="M000163-source">
183
+ onclick="toggleCode('M000172-source');return false;">[Source]</a></p>
184
+ <div class="method-source-code" id="M000172-source">
185
185
  <pre>
186
186
  <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 19</span>
187
187
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">do_render_chain</span>(<span class="ruby-identifier">rendering_context</span>)
@@ -192,11 +192,11 @@ component itself if no decorations were specified.
192
192
  </div>
193
193
  </div>
194
194
 
195
- <div id="method-M000164" class="method-detail">
196
- <a name="M000164"></a>
195
+ <div id="method-M000173" class="method-detail">
196
+ <a name="M000173"></a>
197
197
 
198
198
  <div class="method-heading">
199
- <a href="#M000164" class="method-signature">
199
+ <a href="#M000173" class="method-signature">
200
200
  <span class="method-name">render</span><span class="method-args">()</span>
201
201
  </a>
202
202
  </div>
@@ -213,8 +213,8 @@ view. By default this method does nothing!
213
213
  Use the current renderer as returned by renderer or it&#8217;s short-cut r.
214
214
  </p>
215
215
  <p><a class="source-toggle" href="#"
216
- onclick="toggleCode('M000164-source');return false;">[Source]</a></p>
217
- <div class="method-source-code" id="M000164-source">
216
+ onclick="toggleCode('M000173-source');return false;">[Source]</a></p>
217
+ <div class="method-source-code" id="M000173-source">
218
218
  <pre>
219
219
  <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 30</span>
220
220
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span>
@@ -227,7 +227,7 @@ Use the current renderer as returned by renderer or it&#8217;s short-cut r.
227
227
 
228
228
  </div>
229
229
  <div id="section">
230
- <h2 class="section-title"><a name="SEC00064">Callback</a></h2>
230
+ <h2 class="section-title"><a name="SEC00068">Callback</a></h2>
231
231
  <div class="section-comment">
232
232
 
233
233
  </div>
@@ -243,11 +243,11 @@ Use the current renderer as returned by renderer or it&#8217;s short-cut r.
243
243
  <div id="methods">
244
244
  <h3 class="section-bar">Public Instance methods</h3>
245
245
 
246
- <div id="method-M000166" class="method-detail">
247
- <a name="M000166"></a>
246
+ <div id="method-M000175" class="method-detail">
247
+ <a name="M000175"></a>
248
248
 
249
249
  <div class="method-heading">
250
- <a href="#M000166" class="method-signature">
250
+ <a href="#M000175" class="method-signature">
251
251
  <span class="method-name">process_callbacks</span><span class="method-args">(callback_stream)</span>
252
252
  </a>
253
253
  </div>
@@ -267,8 +267,8 @@ processed/invoked before any of the action callbacks are processed/invoked.
267
267
  </dd>
268
268
  </dl>
269
269
  <p><a class="source-toggle" href="#"
270
- onclick="toggleCode('M000166-source');return false;">[Source]</a></p>
271
- <div class="method-source-code" id="M000166-source">
270
+ onclick="toggleCode('M000175-source');return false;">[Source]</a></p>
271
+ <div class="method-source-code" id="M000175-source">
272
272
  <pre>
273
273
  <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 59</span>
274
274
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_callbacks</span>(<span class="ruby-identifier">callback_stream</span>)
@@ -284,11 +284,11 @@ processed/invoked before any of the action callbacks are processed/invoked.
284
284
  </div>
285
285
  </div>
286
286
 
287
- <div id="method-M000165" class="method-detail">
288
- <a name="M000165"></a>
287
+ <div id="method-M000174" class="method-detail">
288
+ <a name="M000174"></a>
289
289
 
290
290
  <div class="method-heading">
291
- <a href="#M000165" class="method-signature">
291
+ <a href="#M000174" class="method-signature">
292
292
  <span class="method-name">process_callbacks_chain</span><span class="method-args">(callback_stream)</span>
293
293
  </a>
294
294
  </div>
@@ -296,7 +296,7 @@ processed/invoked before any of the action callbacks are processed/invoked.
296
296
  <div class="method-description">
297
297
  <p>
298
298
  Starts processing the callbacks for the decoration chain by invoking method
299
- <a href="Component.html#M000166">process_callbacks</a> of the first
299
+ <a href="Component.html#M000175">process_callbacks</a> of the first
300
300
  decoration or the component itself if no decorations were specified.
301
301
  </p>
302
302
  <dl>
@@ -305,8 +305,8 @@ decoration or the component itself if no decorations were specified.
305
305
  </dd>
306
306
  </dl>
307
307
  <p><a class="source-toggle" href="#"
308
- onclick="toggleCode('M000165-source');return false;">[Source]</a></p>
309
- <div class="method-source-code" id="M000165-source">
308
+ onclick="toggleCode('M000174-source');return false;">[Source]</a></p>
309
+ <div class="method-source-code" id="M000174-source">
310
310
  <pre>
311
311
  <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 46</span>
312
312
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_callbacks_chain</span>(<span class="ruby-identifier">callback_stream</span>)
@@ -320,7 +320,7 @@ decoration or the component itself if no decorations were specified.
320
320
 
321
321
  </div>
322
322
  <div id="section">
323
- <h2 class="section-title"><a name="SEC00065">Init</a></h2>
323
+ <h2 class="section-title"><a name="SEC00069">Init</a></h2>
324
324
  <div class="section-comment">
325
325
 
326
326
  </div>
@@ -336,11 +336,11 @@ decoration or the component itself if no decorations were specified.
336
336
  <div id="methods">
337
337
  <h3 class="section-bar">Protected Instance methods</h3>
338
338
 
339
- <div id="method-M000167" class="method-detail">
340
- <a name="M000167"></a>
339
+ <div id="method-M000176" class="method-detail">
340
+ <a name="M000176"></a>
341
341
 
342
342
  <div class="method-heading">
343
- <a href="#M000167" class="method-signature">
343
+ <a href="#M000176" class="method-signature">
344
344
  <span class="method-name">initialize</span><span class="method-args">()</span>
345
345
  </a>
346
346
  </div>
@@ -354,8 +354,8 @@ Call this method from your own components&#8217; <em>initialize</em> method
354
354
  using <tt>super</tt>, before setting up anything else!
355
355
  </p>
356
356
  <p><a class="source-toggle" href="#"
357
- onclick="toggleCode('M000167-source');return false;">[Source]</a></p>
358
- <div class="method-source-code" id="M000167-source">
357
+ onclick="toggleCode('M000176-source');return false;">[Source]</a></p>
358
+ <div class="method-source-code" id="M000176-source">
359
359
  <pre>
360
360
  <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 79</span>
361
361
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>() <span class="ruby-comment cmt"># :notnew:</span>
@@ -370,7 +370,7 @@ using <tt>super</tt>, before setting up anything else!
370
370
 
371
371
  </div>
372
372
  <div id="section">
373
- <h2 class="section-title"><a name="SEC00066">Children</a></h2>
373
+ <h2 class="section-title"><a name="SEC00070">Children</a></h2>
374
374
  <div class="section-comment">
375
375
 
376
376
  </div>
@@ -386,11 +386,11 @@ using <tt>super</tt>, before setting up anything else!
386
386
  <div id="methods">
387
387
  <h3 class="section-bar">Protected Instance methods</h3>
388
388
 
389
- <div id="method-M000169" class="method-detail">
390
- <a name="M000169"></a>
389
+ <div id="method-M000178" class="method-detail">
390
+ <a name="M000178"></a>
391
391
 
392
392
  <div class="method-heading">
393
- <a href="#M000169" class="method-signature">
393
+ <a href="#M000178" class="method-signature">
394
394
  <span class="method-name">add_child</span><span class="method-args">(child)</span>
395
395
  </a>
396
396
  </div>
@@ -419,8 +419,8 @@ course only if you want backtracking at all):
419
419
  end
420
420
  </pre>
421
421
  <p><a class="source-toggle" href="#"
422
- onclick="toggleCode('M000169-source');return false;">[Source]</a></p>
423
- <div class="method-source-code" id="M000169-source">
422
+ onclick="toggleCode('M000178-source');return false;">[Source]</a></p>
423
+ <div class="method-source-code" id="M000178-source">
424
424
  <pre>
425
425
  <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 115</span>
426
426
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_child</span>(<span class="ruby-identifier">child</span>)
@@ -431,11 +431,11 @@ course only if you want backtracking at all):
431
431
  </div>
432
432
  </div>
433
433
 
434
- <div id="method-M000168" class="method-detail">
435
- <a name="M000168"></a>
434
+ <div id="method-M000177" class="method-detail">
435
+ <a name="M000177"></a>
436
436
 
437
437
  <div class="method-heading">
438
- <a href="#M000168" class="method-signature">
438
+ <a href="#M000177" class="method-signature">
439
439
  <span class="method-name">children</span><span class="method-args">()</span>
440
440
  </a>
441
441
  </div>
@@ -445,8 +445,8 @@ course only if you want backtracking at all):
445
445
  Returns all direct child components collected in an array.
446
446
  </p>
447
447
  <p><a class="source-toggle" href="#"
448
- onclick="toggleCode('M000168-source');return false;">[Source]</a></p>
449
- <div class="method-source-code" id="M000168-source">
448
+ onclick="toggleCode('M000177-source');return false;">[Source]</a></p>
449
+ <div class="method-source-code" id="M000177-source">
450
450
  <pre>
451
451
  <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 92</span>
452
452
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">children</span>
@@ -460,7 +460,7 @@ Returns all direct child components collected in an array.
460
460
 
461
461
  </div>
462
462
  <div id="section">
463
- <h2 class="section-title"><a name="SEC00067">Decoration</a></h2>
463
+ <h2 class="section-title"><a name="SEC00071">Decoration</a></h2>
464
464
  <div class="section-comment">
465
465
 
466
466
  </div>
@@ -476,38 +476,63 @@ Returns all direct child components collected in an array.
476
476
  <div id="methods">
477
477
  <h3 class="section-bar">Public Instance methods</h3>
478
478
 
479
- <div id="method-M000173" class="method-detail">
480
- <a name="M000173"></a>
479
+ <div id="method-M000182" class="method-detail">
480
+ <a name="M000182"></a>
481
481
 
482
482
  <div class="method-heading">
483
- <a href="#M000173" class="method-signature">
483
+ <a href="#M000182" class="method-signature">
484
484
  <span class="method-name">add_decoration</span><span class="method-args">(d)</span>
485
485
  </a>
486
486
  </div>
487
487
 
488
488
  <div class="method-description">
489
489
  <p>
490
- Adds decoration <tt>d</tt> in front of the decoration chain.
490
+ Adds decoration <tt>d</tt> to the decoration chain.
491
+ </p>
492
+ <p>
493
+ A global decoration is added in front of the decoration chain, a local
494
+ decoration is added in front of all other local decorations but after all
495
+ global decorations.
491
496
  </p>
492
497
  <p><a class="source-toggle" href="#"
493
- onclick="toggleCode('M000173-source');return false;">[Source]</a></p>
494
- <div class="method-source-code" id="M000173-source">
498
+ onclick="toggleCode('M000182-source');return false;">[Source]</a></p>
499
+ <div class="method-source-code" id="M000182-source">
495
500
  <pre>
496
- <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 151</span>
501
+ <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 155</span>
497
502
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_decoration</span>(<span class="ruby-identifier">d</span>)
498
- <span class="ruby-identifier">d</span>.<span class="ruby-identifier">owner</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">decoration</span>
499
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">decoration</span> = <span class="ruby-identifier">d</span>
503
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">d</span>.<span class="ruby-identifier">global?</span>
504
+ <span class="ruby-identifier">d</span>.<span class="ruby-identifier">owner</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">decoration</span>
505
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">decoration</span> = <span class="ruby-identifier">d</span>
506
+ <span class="ruby-keyword kw">else</span>
507
+ <span class="ruby-identifier">last_global</span> = <span class="ruby-keyword kw">nil</span>
508
+ <span class="ruby-identifier">each_decoration</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
509
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span>.<span class="ruby-identifier">global?</span>
510
+ <span class="ruby-identifier">last_global</span> = <span class="ruby-identifier">i</span>
511
+ <span class="ruby-keyword kw">else</span>
512
+ <span class="ruby-keyword kw">break</span>
513
+ <span class="ruby-keyword kw">end</span>
514
+ }
515
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">last_global</span>.<span class="ruby-identifier">nil?</span>
516
+ <span class="ruby-comment cmt"># no global decorations specified -&gt; add in front</span>
517
+ <span class="ruby-identifier">d</span>.<span class="ruby-identifier">owner</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">decoration</span>
518
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">decoration</span> = <span class="ruby-identifier">d</span>
519
+ <span class="ruby-keyword kw">else</span>
520
+ <span class="ruby-comment cmt"># add after last_global</span>
521
+ <span class="ruby-identifier">d</span>.<span class="ruby-identifier">owner</span> = <span class="ruby-identifier">last_global</span>.<span class="ruby-identifier">owner</span>
522
+ <span class="ruby-identifier">last_global</span>.<span class="ruby-identifier">owner</span> = <span class="ruby-identifier">d</span>
523
+ <span class="ruby-keyword kw">end</span>
524
+ <span class="ruby-keyword kw">end</span>
500
525
  <span class="ruby-keyword kw">end</span>
501
526
  </pre>
502
527
  </div>
503
528
  </div>
504
529
  </div>
505
530
 
506
- <div id="method-M000170" class="method-detail">
507
- <a name="M000170"></a>
531
+ <div id="method-M000179" class="method-detail">
532
+ <a name="M000179"></a>
508
533
 
509
534
  <div class="method-heading">
510
- <a href="#M000170" class="method-signature">
535
+ <a href="#M000179" class="method-signature">
511
536
  <span class="method-name">decoration</span><span class="method-args">()</span>
512
537
  </a>
513
538
  </div>
@@ -518,8 +543,8 @@ Returns the first decoration from the component&#8217;s decoration chain,
518
543
  or <tt>self</tt> if no decorations were specified for the component.
519
544
  </p>
520
545
  <p><a class="source-toggle" href="#"
521
- onclick="toggleCode('M000170-source');return false;">[Source]</a></p>
522
- <div class="method-source-code" id="M000170-source">
546
+ onclick="toggleCode('M000179-source');return false;">[Source]</a></p>
547
+ <div class="method-source-code" id="M000179-source">
523
548
  <pre>
524
549
  <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 128</span>
525
550
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">decoration</span>
@@ -530,11 +555,11 @@ or <tt>self</tt> if no decorations were specified for the component.
530
555
  </div>
531
556
  </div>
532
557
 
533
- <div id="method-M000171" class="method-detail">
534
- <a name="M000171"></a>
558
+ <div id="method-M000180" class="method-detail">
559
+ <a name="M000180"></a>
535
560
 
536
561
  <div class="method-heading">
537
- <a href="#M000171" class="method-signature">
562
+ <a href="#M000180" class="method-signature">
538
563
  <span class="method-name">decoration=</span><span class="method-args">(d)</span>
539
564
  </a>
540
565
  </div>
@@ -544,8 +569,8 @@ or <tt>self</tt> if no decorations were specified for the component.
544
569
  Set the pointer to the first decoration to <tt>d</tt>.
545
570
  </p>
546
571
  <p><a class="source-toggle" href="#"
547
- onclick="toggleCode('M000171-source');return false;">[Source]</a></p>
548
- <div class="method-source-code" id="M000171-source">
572
+ onclick="toggleCode('M000180-source');return false;">[Source]</a></p>
573
+ <div class="method-source-code" id="M000180-source">
549
574
  <pre>
550
575
  <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 134</span>
551
576
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">decoration=</span>(<span class="ruby-identifier">d</span>)
@@ -556,11 +581,11 @@ Set the pointer to the first decoration to <tt>d</tt>.
556
581
  </div>
557
582
  </div>
558
583
 
559
- <div id="method-M000172" class="method-detail">
560
- <a name="M000172"></a>
584
+ <div id="method-M000181" class="method-detail">
585
+ <a name="M000181"></a>
561
586
 
562
587
  <div class="method-heading">
563
- <a href="#M000172" class="method-signature">
588
+ <a href="#M000181" class="method-signature">
564
589
  <span class="method-name">each_decoration</span><span class="method-args">( {|decoration| ...}</span>
565
590
  </a>
566
591
  </div>
@@ -570,8 +595,8 @@ Set the pointer to the first decoration to <tt>d</tt>.
570
595
  Iterates over all decorations (note that the component itself is excluded).
571
596
  </p>
572
597
  <p><a class="source-toggle" href="#"
573
- onclick="toggleCode('M000172-source');return false;">[Source]</a></p>
574
- <div class="method-source-code" id="M000172-source">
598
+ onclick="toggleCode('M000181-source');return false;">[Source]</a></p>
599
+ <div class="method-source-code" id="M000181-source">
575
600
  <pre>
576
601
  <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 140</span>
577
602
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each_decoration</span> <span class="ruby-comment cmt"># :yields: decoration</span>
@@ -587,11 +612,11 @@ Iterates over all decorations (note that the component itself is excluded).
587
612
  </div>
588
613
  </div>
589
614
 
590
- <div id="method-M000174" class="method-detail">
591
- <a name="M000174"></a>
615
+ <div id="method-M000183" class="method-detail">
616
+ <a name="M000183"></a>
592
617
 
593
618
  <div class="method-heading">
594
- <a href="#M000174" class="method-signature">
619
+ <a href="#M000183" class="method-signature">
595
620
  <span class="method-name">remove_decoration</span><span class="method-args">(d)</span>
596
621
  </a>
597
622
  </div>
@@ -605,10 +630,10 @@ Returns the removed decoration or <tt>nil</tt> if it did not exist in the
605
630
  decoration chain.
606
631
  </p>
607
632
  <p><a class="source-toggle" href="#"
608
- onclick="toggleCode('M000174-source');return false;">[Source]</a></p>
609
- <div class="method-source-code" id="M000174-source">
633
+ onclick="toggleCode('M000183-source');return false;">[Source]</a></p>
634
+ <div class="method-source-code" id="M000183-source">
610
635
  <pre>
611
- <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 161</span>
636
+ <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 185</span>
612
637
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_decoration</span>(<span class="ruby-identifier">d</span>)
613
638
  <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">d</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">decoration</span> <span class="ruby-comment cmt"># 'd' is in front</span>
614
639
  <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">decoration</span> = <span class="ruby-identifier">d</span>.<span class="ruby-identifier">owner</span>
@@ -631,11 +656,11 @@ decoration chain.
631
656
  </div>
632
657
  </div>
633
658
 
634
- <div id="method-M000175" class="method-detail">
635
- <a name="M000175"></a>
659
+ <div id="method-M000184" class="method-detail">
660
+ <a name="M000184"></a>
636
661
 
637
662
  <div class="method-heading">
638
- <a href="#M000175" class="method-signature">
663
+ <a href="#M000184" class="method-signature">
639
664
  <span class="method-name">remove_decoration_if</span><span class="method-args">( {|decoration| ...}</span>
640
665
  </a>
641
666
  </div>
@@ -651,10 +676,10 @@ Example (removes all decorations of class <tt>HaloDecoration</tt>):
651
676
  remove_decoration_if {|d| d.class == HaloDecoration}
652
677
  </pre>
653
678
  <p><a class="source-toggle" href="#"
654
- onclick="toggleCode('M000175-source');return false;">[Source]</a></p>
655
- <div class="method-source-code" id="M000175-source">
679
+ onclick="toggleCode('M000184-source');return false;">[Source]</a></p>
680
+ <div class="method-source-code" id="M000184-source">
656
681
  <pre>
657
- <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 186</span>
682
+ <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 210</span>
658
683
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_decoration_if</span> <span class="ruby-comment cmt"># :yields: decoration</span>
659
684
  <span class="ruby-identifier">to_remove</span> = []
660
685
  <span class="ruby-identifier">each_decoration</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">d</span><span class="ruby-operator">|</span> <span class="ruby-identifier">to_remove</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">d</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">d</span>}
@@ -668,7 +693,7 @@ Example (removes all decorations of class <tt>HaloDecoration</tt>):
668
693
 
669
694
  </div>
670
695
  <div id="section">
671
- <h2 class="section-title"><a name="SEC00068">Backtrack</a></h2>
696
+ <h2 class="section-title"><a name="SEC00072">Backtrack</a></h2>
672
697
  <div class="section-comment">
673
698
 
674
699
  </div>
@@ -684,11 +709,11 @@ Example (removes all decorations of class <tt>HaloDecoration</tt>):
684
709
  <div id="methods">
685
710
  <h3 class="section-bar">Public Instance methods</h3>
686
711
 
687
- <div id="method-M000177" class="method-detail">
688
- <a name="M000177"></a>
712
+ <div id="method-M000186" class="method-detail">
713
+ <a name="M000186"></a>
689
714
 
690
715
  <div class="method-heading">
691
- <a href="#M000177" class="method-signature">
716
+ <a href="#M000186" class="method-signature">
692
717
  <span class="method-name">backtrack_state</span><span class="method-args">(snapshot)</span>
693
718
  </a>
694
719
  </div>
@@ -715,7 +740,7 @@ the decoration-object itself!).
715
740
  <p>
716
741
  For example if you dynamically add children to your component, you might
717
742
  want to backtrack the children array. Therefore you simply pass it to the
718
- <a href="Snapshot.html#M000069">Snapshot#add</a> method:
743
+ <a href="Snapshot.html#M000075">Snapshot#add</a> method:
719
744
  </p>
720
745
  <pre>
721
746
  def backtrack_state(snapshot)
@@ -737,10 +762,10 @@ as argument.
737
762
  </dd>
738
763
  </dl>
739
764
  <p><a class="source-toggle" href="#"
740
- onclick="toggleCode('M000177-source');return false;">[Source]</a></p>
741
- <div class="method-source-code" id="M000177-source">
765
+ onclick="toggleCode('M000186-source');return false;">[Source]</a></p>
766
+ <div class="method-source-code" id="M000186-source">
742
767
  <pre>
743
- <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 243</span>
768
+ <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 267</span>
744
769
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">backtrack_state</span>(<span class="ruby-identifier">snapshot</span>)
745
770
  <span class="ruby-identifier">snapshot</span>.<span class="ruby-identifier">add</span>(<span class="ruby-ivar">@decoration</span>)
746
771
  <span class="ruby-identifier">children</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">child</span><span class="ruby-operator">|</span> <span class="ruby-identifier">child</span>.<span class="ruby-identifier">backtrack_state_chain</span>(<span class="ruby-identifier">snapshot</span>) <span class="ruby-keyword kw">end</span>
@@ -750,11 +775,11 @@ as argument.
750
775
  </div>
751
776
  </div>
752
777
 
753
- <div id="method-M000176" class="method-detail">
754
- <a name="M000176"></a>
778
+ <div id="method-M000185" class="method-detail">
779
+ <a name="M000185"></a>
755
780
 
756
781
  <div class="method-heading">
757
- <a href="#M000176" class="method-signature">
782
+ <a href="#M000185" class="method-signature">
758
783
  <span class="method-name">backtrack_state_chain</span><span class="method-args">(snapshot)</span>
759
784
  </a>
760
785
  </div>
@@ -762,11 +787,11 @@ as argument.
762
787
  <div class="method-description">
763
788
  <p>
764
789
  Starts the backtrack-state phase for the decoration chain, by invoking
765
- method <a href="Component.html#M000177">backtrack_state</a> of the first
790
+ method <a href="Component.html#M000186">backtrack_state</a> of the first
766
791
  decoration or the component itself if no decorations were specified.
767
792
  </p>
768
793
  <p>
769
- See <a href="Component.html#M000177">backtrack_state</a> for details.
794
+ See <a href="Component.html#M000186">backtrack_state</a> for details.
770
795
  </p>
771
796
  <dl>
772
797
  <dt><tt>snapshot</tt></dt><dd>An object of class <a href="Snapshot.html">Snapshot</a>
@@ -774,10 +799,10 @@ See <a href="Component.html#M000177">backtrack_state</a> for details.
774
799
  </dd>
775
800
  </dl>
776
801
  <p><a class="source-toggle" href="#"
777
- onclick="toggleCode('M000176-source');return false;">[Source]</a></p>
778
- <div class="method-source-code" id="M000176-source">
802
+ onclick="toggleCode('M000185-source');return false;">[Source]</a></p>
803
+ <div class="method-source-code" id="M000185-source">
779
804
  <pre>
780
- <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 207</span>
805
+ <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 231</span>
781
806
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">backtrack_state_chain</span>(<span class="ruby-identifier">snapshot</span>)
782
807
  <span class="ruby-identifier">decoration</span>.<span class="ruby-identifier">backtrack_state</span>(<span class="ruby-identifier">snapshot</span>)
783
808
  <span class="ruby-keyword kw">end</span>
@@ -789,7 +814,7 @@ See <a href="Component.html#M000177">backtrack_state</a> for details.
789
814
 
790
815
  </div>
791
816
  <div id="section">
792
- <h2 class="section-title"><a name="SEC00069">Call/Answer</a></h2>
817
+ <h2 class="section-title"><a name="SEC00073">Call/Answer</a></h2>
793
818
  <div class="section-comment">
794
819
 
795
820
  </div>
@@ -805,11 +830,11 @@ See <a href="Component.html#M000177">backtrack_state</a> for details.
805
830
  <div id="methods">
806
831
  <h3 class="section-bar">Protected Instance methods</h3>
807
832
 
808
- <div id="method-M000179" class="method-detail">
809
- <a name="M000179"></a>
833
+ <div id="method-M000188" class="method-detail">
834
+ <a name="M000188"></a>
810
835
 
811
836
  <div class="method-heading">
812
- <a href="#M000179" class="method-signature">
837
+ <a href="#M000188" class="method-signature">
813
838
  <span class="method-name">answer</span><span class="method-args">(*args)</span>
814
839
  </a>
815
840
  </div>
@@ -819,17 +844,17 @@ See <a href="Component.html#M000177">backtrack_state</a> for details.
819
844
  Return from a called component.
820
845
  </p>
821
846
  <p>
822
- NOTE that <a href="Component.html#M000179">answer</a> never returns.
847
+ NOTE that <a href="Component.html#M000188">answer</a> never returns.
823
848
  </p>
824
849
  <p>
825
- See <a href="Component.html#M000178">call</a> for a detailed description of
850
+ See <a href="Component.html#M000187">call</a> for a detailed description of
826
851
  the call/answer mechanism.
827
852
  </p>
828
853
  <p><a class="source-toggle" href="#"
829
- onclick="toggleCode('M000179-source');return false;">[Source]</a></p>
830
- <div class="method-source-code" id="M000179-source">
854
+ onclick="toggleCode('M000188-source');return false;">[Source]</a></p>
855
+ <div class="method-source-code" id="M000188-source">
831
856
  <pre>
832
- <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 310</span>
857
+ <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 334</span>
833
858
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">answer</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
834
859
  <span class="ruby-identifier">throw</span> <span class="ruby-identifier">:wee_answer</span>, <span class="ruby-identifier">args</span>
835
860
  <span class="ruby-keyword kw">end</span>
@@ -838,11 +863,11 @@ the call/answer mechanism.
838
863
  </div>
839
864
  </div>
840
865
 
841
- <div id="method-M000178" class="method-detail">
842
- <a name="M000178"></a>
866
+ <div id="method-M000187" class="method-detail">
867
+ <a name="M000187"></a>
843
868
 
844
869
  <div class="method-heading">
845
- <a href="#M000178" class="method-signature">
870
+ <a href="#M000187" class="method-signature">
846
871
  <span class="method-name">call</span><span class="method-args">(component, return_callback=:use_continuation)</span>
847
872
  </a>
848
873
  </div>
@@ -851,7 +876,7 @@ the call/answer mechanism.
851
876
  <p>
852
877
  Call another component. The calling component is neither rendered nor are
853
878
  it&#8217;s callbacks processed until the called component answers using
854
- method <a href="Component.html#M000179">answer</a>.
879
+ method <a href="Component.html#M000188">answer</a>.
855
880
  </p>
856
881
  <dl>
857
882
  <dt><tt>component</tt></dt><dd>The component to be called.
@@ -871,15 +896,15 @@ calling component (self), which delegates to the component to be called
871
896
  href="Session.html">Session</a> by throwing <em>:wee_back_to_session</em>.
872
897
  This means, that there is only ever one action callback invoked per
873
898
  request. When at a later point in time the called component invokes <a
874
- href="Component.html#M000179">answer</a>, this will throw a
899
+ href="Component.html#M000188">answer</a>, this will throw a
875
900
  <em>:wee_answer</em> exception which is catched in the <a
876
901
  href="AnswerDecoration.html">AnswerDecoration</a>. The <a
877
902
  href="AnswerDecoration.html">AnswerDecoration</a> then jumps back to the
878
903
  continuation we created at the beginning, and finally method <a
879
- href="Component.html#M000178">call</a> returns.
904
+ href="Component.html#M000187">call</a> returns.
880
905
  </p>
881
906
  <p>
882
- Note that <a href="Component.html#M000178">call</a> returns to an
907
+ Note that <a href="Component.html#M000187">call</a> returns to an
883
908
  &quot;old&quot; stack-frame from a previous request. That is why we throw
884
909
  <em>:wee_back_to_session</em> after invoking an action callback, and
885
910
  that&#8217;s why only ever one is invoked. We could remove this limitation
@@ -887,10 +912,10 @@ without problems, but then there would be a difference between those action
887
912
  callbacks that call other components and those that do not.
888
913
  </p>
889
914
  <p><a class="source-toggle" href="#"
890
- onclick="toggleCode('M000178-source');return false;">[Source]</a></p>
891
- <div class="method-source-code" id="M000178-source">
915
+ onclick="toggleCode('M000187-source');return false;">[Source]</a></p>
916
+ <div class="method-source-code" id="M000187-source">
892
917
  <pre>
893
- <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 281</span>
918
+ <span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 305</span>
894
919
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">component</span>, <span class="ruby-identifier">return_callback</span>=<span class="ruby-identifier">:use_continuation</span>)
895
920
  <span class="ruby-identifier">add_decoration</span>(<span class="ruby-identifier">delegate</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">Delegate</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">component</span>))
896
921
  <span class="ruby-identifier">component</span>.<span class="ruby-identifier">add_decoration</span>(<span class="ruby-identifier">answer</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">AnswerDecoration</span>.<span class="ruby-identifier">new</span>)