wee 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +75 -0
- data/README +17 -9
- data/Rakefile +2 -2
- data/TODO +20 -0
- data/benchmark/Makefile +14 -9
- data/benchmark/counter.rb +11 -30
- data/benchmark/report_req.rb +12 -0
- data/doc/rdoc/classes/Array.html +12 -12
- data/doc/rdoc/classes/Cache/StorageCache.html +38 -38
- data/doc/rdoc/classes/Cache/Strategy/CapacityBounded.html +30 -30
- data/doc/rdoc/classes/Cache/Strategy/LFU.html +24 -24
- data/doc/rdoc/classes/Cache/Strategy/LRU.html +24 -24
- data/doc/rdoc/classes/Cache/Strategy/Unbounded.html +24 -24
- data/doc/rdoc/classes/Enumerable.html +6 -6
- data/doc/rdoc/classes/Object.html +12 -12
- data/doc/rdoc/classes/OgApplication.html +126 -0
- data/doc/rdoc/classes/OgScaffolder.html +401 -0
- data/doc/rdoc/classes/OgSession.html +172 -0
- data/doc/rdoc/classes/String.html +12 -12
- data/doc/rdoc/classes/Struct.html +12 -12
- data/doc/rdoc/classes/Wee.html +5 -62
- data/doc/rdoc/classes/Wee/AnswerDecoration.html +9 -9
- data/doc/rdoc/classes/Wee/Application.html +107 -39
- data/doc/rdoc/classes/Wee/Brush.html +22 -18
- data/doc/rdoc/classes/Wee/Brush/ActionCallbackMixin.html +17 -11
- data/doc/rdoc/classes/Wee/Brush/ActionURLCallbackMixin.html +18 -10
- data/doc/rdoc/classes/Wee/Brush/AnchorTag.html +30 -64
- data/doc/rdoc/classes/Wee/Brush/FileUploadTag.html +8 -10
- data/doc/rdoc/classes/Wee/Brush/FormTag.html +27 -79
- data/doc/rdoc/classes/Wee/Brush/GenericEncodedTextBrush.html +12 -12
- data/doc/rdoc/classes/Wee/Brush/GenericSingleTagBrush.html +146 -0
- data/doc/rdoc/classes/Wee/Brush/GenericTagBrush.html +179 -65
- data/doc/rdoc/classes/Wee/Brush/GenericTextBrush.html +12 -12
- data/doc/rdoc/classes/Wee/Brush/ImageButtonTag.html +16 -18
- data/doc/rdoc/classes/Wee/Brush/ImageTag.html +203 -0
- data/doc/rdoc/classes/Wee/Brush/InputCallbackMixin.html +17 -11
- data/doc/rdoc/classes/Wee/Brush/InputTag.html +15 -15
- data/doc/rdoc/classes/Wee/Brush/JavascriptTag.html +147 -0
- data/doc/rdoc/classes/Wee/Brush/Page.html +17 -17
- data/doc/rdoc/classes/Wee/Brush/SelectListTag.html +25 -50
- data/doc/rdoc/classes/Wee/Brush/SelectOptionTag.html +7 -38
- data/doc/rdoc/classes/Wee/Brush/SubmitButtonTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/TableDataTag.html +15 -16
- data/doc/rdoc/classes/Wee/Brush/TableHeaderTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/TableRowTag.html +65 -50
- data/doc/rdoc/classes/Wee/Brush/TableTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/TextAreaTag.html +14 -64
- data/doc/rdoc/classes/Wee/Brush/TextInputTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/ToCallback.html +146 -0
- data/doc/rdoc/classes/Wee/CallbackRegistry.html +40 -40
- data/doc/rdoc/classes/Wee/CallbackStream.html +18 -18
- data/doc/rdoc/classes/Wee/Canvas.html +24 -24
- data/doc/rdoc/classes/Wee/Component.html +232 -149
- data/doc/rdoc/classes/Wee/Component/OnAnswer.html +153 -0
- data/doc/rdoc/classes/Wee/Decoration.html +42 -42
- data/doc/rdoc/classes/Wee/Delegate.html +27 -27
- data/doc/rdoc/classes/Wee/ErrorResponse.html +12 -12
- data/doc/rdoc/classes/Wee/FormDecoration.html +148 -0
- data/doc/rdoc/classes/Wee/GenericResponse.html +6 -6
- data/doc/rdoc/classes/Wee/HtmlCanvas.html +296 -215
- data/doc/rdoc/classes/Wee/HtmlWriter.html +83 -81
- data/doc/rdoc/classes/Wee/LiteralMethodCallback.html +21 -16
- data/doc/rdoc/classes/Wee/MessageBox.html +180 -0
- data/doc/rdoc/classes/Wee/PageDecoration.html +30 -30
- data/doc/rdoc/classes/Wee/Presenter.html +237 -69
- data/doc/rdoc/classes/Wee/RedirectResponse.html +6 -6
- data/doc/rdoc/classes/Wee/RefreshResponse.html +6 -6
- data/doc/rdoc/classes/Wee/Request.html +18 -18
- data/doc/rdoc/classes/Wee/RequestHandler.html +43 -39
- data/doc/rdoc/classes/Wee/Response.html +24 -24
- data/doc/rdoc/classes/Wee/Session.html +746 -72
- data/doc/rdoc/classes/Wee/SimpleIdGenerator.html +18 -18
- data/doc/rdoc/classes/Wee/Snapshot.html +19 -19
- data/doc/rdoc/classes/Wee/Utils.html +138 -2
- data/doc/rdoc/classes/Wee/Utils/LRUCache.html +7 -7
- data/doc/rdoc/classes/Wee/ValueHolder.html +18 -18
- data/doc/rdoc/classes/Wee/WEBrickAdaptor.html +43 -68
- data/doc/rdoc/classes/Wee/WrapperDecoration.html +150 -0
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README.html +29 -15
- data/doc/rdoc/files/lib/wee/adaptors/webrick_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/application_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/components/form_decoration_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/components/messagebox_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/components/page_decoration_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/components/wrapper_decoration_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/components_rb.html +4 -1
- data/doc/rdoc/files/lib/wee/continuation/core/component_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/continuation/session_rb.html +110 -0
- data/doc/rdoc/files/lib/wee/continuation_rb.html +116 -0
- data/doc/rdoc/files/lib/wee/core/callback_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/core/component_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/core/presenter_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/core_rb.html +3 -3
- data/doc/rdoc/files/lib/wee/databases/og_rb.html +108 -0
- data/doc/rdoc/files/lib/wee/renderer/html/brushes_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/renderer/html/canvas_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/renderer/html/writer_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/requesthandler_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/session_rb.html +1 -2
- data/doc/rdoc/files/lib/wee/utils/autoreload_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/utils/cache_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/utils/helper_rb.html +1 -8
- data/doc/rdoc/files/lib/wee/utils_rb.html +110 -0
- data/doc/rdoc/files/lib/wee_rb.html +1 -1
- data/doc/rdoc/fr_class_index.html +11 -1
- data/doc/rdoc/fr_file_index.html +8 -0
- data/doc/rdoc/fr_method_index.html +269 -228
- data/examples/calculator.rb +69 -0
- data/examples/calendar.rb +5 -17
- data/examples/example.rb +2 -2
- data/examples/hw.rb +17 -0
- data/examples/live-update.rb +45 -0
- data/examples/og-test.rb +51 -0
- data/lib/wee.rb +1 -1
- data/lib/wee/adaptors/webrick.rb +2 -0
- data/lib/wee/application.rb +16 -0
- data/lib/wee/components.rb +3 -0
- data/lib/wee/components/form_decoration.rb +7 -0
- data/{test → lib/wee}/components/messagebox.rb +1 -1
- data/lib/wee/components/page_decoration.rb +5 -5
- data/lib/wee/components/wrapper_decoration.rb +7 -0
- data/lib/wee/continuation.rb +5 -0
- data/lib/wee/continuation/core/component.rb +55 -0
- data/lib/wee/continuation/session.rb +217 -0
- data/lib/wee/core/callback.rb +11 -6
- data/lib/wee/core/component.rb +45 -33
- data/lib/wee/core/presenter.rb +68 -0
- data/lib/wee/databases/og.rb +114 -0
- data/lib/wee/renderer/html/brushes.rb +179 -98
- data/lib/wee/renderer/html/canvas.rb +37 -13
- data/lib/wee/renderer/html/writer.rb +34 -32
- data/lib/wee/requesthandler.rb +6 -3
- data/lib/wee/session.rb +73 -54
- data/lib/wee/utils.rb +5 -0
- data/lib/wee/utils/autoreload.rb +1 -1
- data/lib/wee/utils/cache.rb +0 -2
- data/lib/wee/utils/helper.rb +40 -8
- data/test/components/calltest-cont.rb +16 -0
- data/test/components/calltest.rb +15 -10
- data/test/stress.rb +31 -28
- data/test/stress_and_measure.rb +53 -0
- data/test/stressed_application.rb +15 -0
- data/test/test_html_writer.rb +9 -4
- metadata +236 -195
- data/benchmark/bench.sh +0 -24
@@ -94,9 +94,9 @@ The intersection of registered callbacks and those that occured.
|
|
94
94
|
<h3 class="section-bar">Methods</h3>
|
95
95
|
|
96
96
|
<div class="name-list">
|
97
|
-
<a href="#
|
98
|
-
<a href="#
|
99
|
-
<a href="#
|
97
|
+
<a href="#M000255">all_of_type</a>
|
98
|
+
<a href="#M000253">new</a>
|
99
|
+
<a href="#M000254">with_callbacks_for</a>
|
100
100
|
</div>
|
101
101
|
</div>
|
102
102
|
|
@@ -118,11 +118,11 @@ The intersection of registered callbacks and those that occured.
|
|
118
118
|
<div id="methods">
|
119
119
|
<h3 class="section-bar">Public Class methods</h3>
|
120
120
|
|
121
|
-
<div id="method-
|
122
|
-
<a name="
|
121
|
+
<div id="method-M000253" class="method-detail">
|
122
|
+
<a name="M000253"></a>
|
123
123
|
|
124
124
|
<div class="method-heading">
|
125
|
-
<a href="#
|
125
|
+
<a href="#M000253" class="method-signature">
|
126
126
|
<span class="method-name">new</span><span class="method-args">(callbacks, ids_and_values)</span>
|
127
127
|
</a>
|
128
128
|
</div>
|
@@ -138,8 +138,8 @@ occurend in a request, e.g. { id => value }.
|
|
138
138
|
</dd>
|
139
139
|
</dl>
|
140
140
|
<p><a class="source-toggle" href="#"
|
141
|
-
onclick="toggleCode('
|
142
|
-
<div class="method-source-code" id="
|
141
|
+
onclick="toggleCode('M000253-source');return false;">[Source]</a></p>
|
142
|
+
<div class="method-source-code" id="M000253-source">
|
143
143
|
<pre>
|
144
144
|
<span class="ruby-comment cmt"># File lib/wee/core/callback.rb, line 72</span>
|
145
145
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">callbacks</span>, <span class="ruby-identifier">ids_and_values</span>)
|
@@ -154,11 +154,11 @@ occurend in a request, e.g. { id => value }.
|
|
154
154
|
|
155
155
|
<h3 class="section-bar">Public Instance methods</h3>
|
156
156
|
|
157
|
-
<div id="method-
|
158
|
-
<a name="
|
157
|
+
<div id="method-M000255" class="method-detail">
|
158
|
+
<a name="M000255"></a>
|
159
159
|
|
160
160
|
<div class="method-heading">
|
161
|
-
<a href="#
|
161
|
+
<a href="#M000255" class="method-signature">
|
162
162
|
<span class="method-name">all_of_type</span><span class="method-args">(type)</span>
|
163
163
|
</a>
|
164
164
|
</div>
|
@@ -169,8 +169,8 @@ Returns a [callback, value] array of all callbacks of <tt>type</tt> for
|
|
169
169
|
which an id was given.
|
170
170
|
</p>
|
171
171
|
<p><a class="source-toggle" href="#"
|
172
|
-
onclick="toggleCode('
|
173
|
-
<div class="method-source-code" id="
|
172
|
+
onclick="toggleCode('M000255-source');return false;">[Source]</a></p>
|
173
|
+
<div class="method-source-code" id="M000255-source">
|
174
174
|
<pre>
|
175
175
|
<span class="ruby-comment cmt"># File lib/wee/core/callback.rb, line 89</span>
|
176
176
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">all_of_type</span>(<span class="ruby-identifier">type</span>)
|
@@ -185,19 +185,19 @@ which an id was given.
|
|
185
185
|
</div>
|
186
186
|
</div>
|
187
187
|
|
188
|
-
<div id="method-
|
189
|
-
<a name="
|
188
|
+
<div id="method-M000254" class="method-detail">
|
189
|
+
<a name="M000254"></a>
|
190
190
|
|
191
191
|
<div class="method-heading">
|
192
|
-
<a href="#
|
192
|
+
<a href="#M000254" class="method-signature">
|
193
193
|
<span class="method-name">with_callbacks_for</span><span class="method-args">(object, type) {|@callbacks.get_callback_for(id, type), @ids_and_values[id]| ...}</span>
|
194
194
|
</a>
|
195
195
|
</div>
|
196
196
|
|
197
197
|
<div class="method-description">
|
198
198
|
<p><a class="source-toggle" href="#"
|
199
|
-
onclick="toggleCode('
|
200
|
-
<div class="method-source-code" id="
|
199
|
+
onclick="toggleCode('M000254-source');return false;">[Source]</a></p>
|
200
|
+
<div class="method-source-code" id="M000254-source">
|
201
201
|
<pre>
|
202
202
|
<span class="ruby-comment cmt"># File lib/wee/core/callback.rb, line 78</span>
|
203
203
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">with_callbacks_for</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">type</span>)
|
@@ -88,10 +88,10 @@
|
|
88
88
|
<h3 class="section-bar">Methods</h3>
|
89
89
|
|
90
90
|
<div class="name-list">
|
91
|
-
<a href="#
|
92
|
-
<a href="#
|
93
|
-
<a href="#
|
94
|
-
<a href="#
|
91
|
+
<a href="#M000198">close</a>
|
92
|
+
<a href="#M000200">nest</a>
|
93
|
+
<a href="#M000197">new</a>
|
94
|
+
<a href="#M000199">set_brush</a>
|
95
95
|
</div>
|
96
96
|
</div>
|
97
97
|
|
@@ -113,19 +113,19 @@
|
|
113
113
|
<div id="methods">
|
114
114
|
<h3 class="section-bar">Public Class methods</h3>
|
115
115
|
|
116
|
-
<div id="method-
|
117
|
-
<a name="
|
116
|
+
<div id="method-M000197" class="method-detail">
|
117
|
+
<a name="M000197"></a>
|
118
118
|
|
119
119
|
<div class="method-heading">
|
120
|
-
<a href="#
|
120
|
+
<a href="#M000197" class="method-signature">
|
121
121
|
<span class="method-name">new</span><span class="method-args">()</span>
|
122
122
|
</a>
|
123
123
|
</div>
|
124
124
|
|
125
125
|
<div class="method-description">
|
126
126
|
<p><a class="source-toggle" href="#"
|
127
|
-
onclick="toggleCode('
|
128
|
-
<div class="method-source-code" id="
|
127
|
+
onclick="toggleCode('M000197-source');return false;">[Source]</a></p>
|
128
|
+
<div class="method-source-code" id="M000197-source">
|
129
129
|
<pre>
|
130
130
|
<span class="ruby-comment cmt"># File lib/wee/renderer/html/canvas.rb, line 4</span>
|
131
131
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
|
@@ -139,19 +139,19 @@
|
|
139
139
|
|
140
140
|
<h3 class="section-bar">Public Instance methods</h3>
|
141
141
|
|
142
|
-
<div id="method-
|
143
|
-
<a name="
|
142
|
+
<div id="method-M000198" class="method-detail">
|
143
|
+
<a name="M000198"></a>
|
144
144
|
|
145
145
|
<div class="method-heading">
|
146
|
-
<a href="#
|
146
|
+
<a href="#M000198" class="method-signature">
|
147
147
|
<span class="method-name">close</span><span class="method-args">()</span>
|
148
148
|
</a>
|
149
149
|
</div>
|
150
150
|
|
151
151
|
<div class="method-description">
|
152
152
|
<p><a class="source-toggle" href="#"
|
153
|
-
onclick="toggleCode('
|
154
|
-
<div class="method-source-code" id="
|
153
|
+
onclick="toggleCode('M000198-source');return false;">[Source]</a></p>
|
154
|
+
<div class="method-source-code" id="M000198-source">
|
155
155
|
<pre>
|
156
156
|
<span class="ruby-comment cmt"># File lib/wee/renderer/html/canvas.rb, line 9</span>
|
157
157
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close</span>
|
@@ -163,19 +163,19 @@
|
|
163
163
|
</div>
|
164
164
|
</div>
|
165
165
|
|
166
|
-
<div id="method-
|
167
|
-
<a name="
|
166
|
+
<div id="method-M000200" class="method-detail">
|
167
|
+
<a name="M000200"></a>
|
168
168
|
|
169
169
|
<div class="method-heading">
|
170
|
-
<a href="#
|
170
|
+
<a href="#M000200" class="method-signature">
|
171
171
|
<span class="method-name">nest</span><span class="method-args">(&block)</span>
|
172
172
|
</a>
|
173
173
|
</div>
|
174
174
|
|
175
175
|
<div class="method-description">
|
176
176
|
<p><a class="source-toggle" href="#"
|
177
|
-
onclick="toggleCode('
|
178
|
-
<div class="method-source-code" id="
|
177
|
+
onclick="toggleCode('M000200-source');return false;">[Source]</a></p>
|
178
|
+
<div class="method-source-code" id="M000200-source">
|
179
179
|
<pre>
|
180
180
|
<span class="ruby-comment cmt"># File lib/wee/renderer/html/canvas.rb, line 25</span>
|
181
181
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nest</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
@@ -190,19 +190,19 @@
|
|
190
190
|
</div>
|
191
191
|
</div>
|
192
192
|
|
193
|
-
<div id="method-
|
194
|
-
<a name="
|
193
|
+
<div id="method-M000199" class="method-detail">
|
194
|
+
<a name="M000199"></a>
|
195
195
|
|
196
196
|
<div class="method-heading">
|
197
|
-
<a href="#
|
197
|
+
<a href="#M000199" class="method-signature">
|
198
198
|
<span class="method-name">set_brush</span><span class="method-args">(brush)</span>
|
199
199
|
</a>
|
200
200
|
</div>
|
201
201
|
|
202
202
|
<div class="method-description">
|
203
203
|
<p><a class="source-toggle" href="#"
|
204
|
-
onclick="toggleCode('
|
205
|
-
<div class="method-source-code" id="
|
204
|
+
onclick="toggleCode('M000199-source');return false;">[Source]</a></p>
|
205
|
+
<div class="method-source-code" id="M000199-source">
|
206
206
|
<pre>
|
207
207
|
<span class="ruby-comment cmt"># File lib/wee/renderer/html/canvas.rb, line 14</span>
|
208
208
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_brush</span>(<span class="ruby-identifier">brush</span>)
|
@@ -58,6 +58,10 @@
|
|
58
58
|
<a href="../../files/lib/wee/core/component_rb.html">
|
59
59
|
lib/wee/core/component.rb
|
60
60
|
</a>
|
61
|
+
<br />
|
62
|
+
<a href="../../files/lib/wee/continuation/core/component_rb.html">
|
63
|
+
lib/wee/continuation/core/component.rb
|
64
|
+
</a>
|
61
65
|
<br />
|
62
66
|
</td>
|
63
67
|
</tr>
|
@@ -83,7 +87,7 @@
|
|
83
87
|
<div id="description">
|
84
88
|
<p>
|
85
89
|
The base class of all components. You should at least overwrite method <a
|
86
|
-
href="Component.html#
|
90
|
+
href="Component.html#M000209">render</a> in your own subclasses.
|
87
91
|
</p>
|
88
92
|
|
89
93
|
</div>
|
@@ -92,13 +96,14 @@ href="Component.html#M000173">render</a> in your own subclasses.
|
|
92
96
|
<div id="contents-list">
|
93
97
|
<h3 class="section-bar">Contents</h3>
|
94
98
|
<ul>
|
95
|
-
<li><a href="#
|
96
|
-
<li><a href="#
|
97
|
-
<li><a href="#
|
98
|
-
<li><a href="#
|
99
|
-
<li><a href="#
|
100
|
-
<li><a href="#
|
101
|
-
<li><a href="#
|
99
|
+
<li><a href="#SEC00074">Render</a></li>
|
100
|
+
<li><a href="#SEC00075">Callback</a></li>
|
101
|
+
<li><a href="#SEC00076">Init</a></li>
|
102
|
+
<li><a href="#SEC00077">Children</a></li>
|
103
|
+
<li><a href="#SEC00078">Decoration</a></li>
|
104
|
+
<li><a href="#SEC00079">Backtrack</a></li>
|
105
|
+
<li><a href="#SEC00080">Call/Answer</a></li>
|
106
|
+
<li><a href="#SEC00120">Call/Answer</a></li>
|
102
107
|
</ul>
|
103
108
|
</div>
|
104
109
|
|
@@ -106,23 +111,24 @@ href="Component.html#M000173">render</a> in your own subclasses.
|
|
106
111
|
<h3 class="section-bar">Methods</h3>
|
107
112
|
|
108
113
|
<div class="name-list">
|
109
|
-
<a href="#
|
110
|
-
<a href="#
|
111
|
-
<a href="#
|
112
|
-
<a href="#
|
113
|
-
<a href="#
|
114
|
-
<a href="#
|
115
|
-
<a href="#
|
116
|
-
<a href="#
|
117
|
-
<a href="#
|
118
|
-
<a href="#
|
119
|
-
<a href="#
|
120
|
-
<a href="#
|
121
|
-
<a href="#
|
122
|
-
<a href="#
|
123
|
-
<a href="#
|
124
|
-
<a href="#
|
125
|
-
<a href="#
|
114
|
+
<a href="#M000214">add_child</a>
|
115
|
+
<a href="#M000218">add_decoration</a>
|
116
|
+
<a href="#M000224">answer</a>
|
117
|
+
<a href="#M000222">backtrack_state</a>
|
118
|
+
<a href="#M000221">backtrack_state_chain</a>
|
119
|
+
<a href="#M000223">call</a>
|
120
|
+
<a href="#M000225">call</a>
|
121
|
+
<a href="#M000213">children</a>
|
122
|
+
<a href="#M000215">decoration</a>
|
123
|
+
<a href="#M000216">decoration=</a>
|
124
|
+
<a href="#M000208">do_render_chain</a>
|
125
|
+
<a href="#M000217">each_decoration</a>
|
126
|
+
<a href="#M000212">initialize</a>
|
127
|
+
<a href="#M000211">process_callbacks</a>
|
128
|
+
<a href="#M000210">process_callbacks_chain</a>
|
129
|
+
<a href="#M000219">remove_decoration</a>
|
130
|
+
<a href="#M000220">remove_decoration_if</a>
|
131
|
+
<a href="#M000209">render</a>
|
126
132
|
</div>
|
127
133
|
</div>
|
128
134
|
|
@@ -142,7 +148,7 @@ href="Component.html#M000173">render</a> in your own subclasses.
|
|
142
148
|
|
143
149
|
<!-- if method_list -->
|
144
150
|
<div id="section">
|
145
|
-
<h2 class="section-title"><a name="
|
151
|
+
<h2 class="section-title"><a name="SEC00074">Render</a></h2>
|
146
152
|
<div class="section-comment">
|
147
153
|
|
148
154
|
</div>
|
@@ -158,11 +164,11 @@ href="Component.html#M000173">render</a> in your own subclasses.
|
|
158
164
|
<div id="methods">
|
159
165
|
<h3 class="section-bar">Public Instance methods</h3>
|
160
166
|
|
161
|
-
<div id="method-
|
162
|
-
<a name="
|
167
|
+
<div id="method-M000208" class="method-detail">
|
168
|
+
<a name="M000208"></a>
|
163
169
|
|
164
170
|
<div class="method-heading">
|
165
|
-
<a href="#
|
171
|
+
<a href="#M000208" class="method-signature">
|
166
172
|
<span class="method-name">do_render_chain</span><span class="method-args">(rendering_context)</span>
|
167
173
|
</a>
|
168
174
|
</div>
|
@@ -170,7 +176,7 @@ href="Component.html#M000173">render</a> in your own subclasses.
|
|
170
176
|
<div class="method-description">
|
171
177
|
<p>
|
172
178
|
Starts rendering the decoration chain by calling method <a
|
173
|
-
href="Presenter.html#
|
179
|
+
href="Presenter.html#M000229">Presenter#do_render</a> for the first
|
174
180
|
decoration of the component, or calling <em>do_render</em> for the
|
175
181
|
component itself if no decorations were specified.
|
176
182
|
</p>
|
@@ -180,8 +186,8 @@ component itself if no decorations were specified.
|
|
180
186
|
</dd>
|
181
187
|
</dl>
|
182
188
|
<p><a class="source-toggle" href="#"
|
183
|
-
onclick="toggleCode('
|
184
|
-
<div class="method-source-code" id="
|
189
|
+
onclick="toggleCode('M000208-source');return false;">[Source]</a></p>
|
190
|
+
<div class="method-source-code" id="M000208-source">
|
185
191
|
<pre>
|
186
192
|
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 19</span>
|
187
193
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">do_render_chain</span>(<span class="ruby-identifier">rendering_context</span>)
|
@@ -192,11 +198,11 @@ component itself if no decorations were specified.
|
|
192
198
|
</div>
|
193
199
|
</div>
|
194
200
|
|
195
|
-
<div id="method-
|
196
|
-
<a name="
|
201
|
+
<div id="method-M000209" class="method-detail">
|
202
|
+
<a name="M000209"></a>
|
197
203
|
|
198
204
|
<div class="method-heading">
|
199
|
-
<a href="#
|
205
|
+
<a href="#M000209" class="method-signature">
|
200
206
|
<span class="method-name">render</span><span class="method-args">()</span>
|
201
207
|
</a>
|
202
208
|
</div>
|
@@ -213,8 +219,8 @@ view. By default this method does nothing!
|
|
213
219
|
Use the current renderer as returned by renderer or it’s short-cut r.
|
214
220
|
</p>
|
215
221
|
<p><a class="source-toggle" href="#"
|
216
|
-
onclick="toggleCode('
|
217
|
-
<div class="method-source-code" id="
|
222
|
+
onclick="toggleCode('M000209-source');return false;">[Source]</a></p>
|
223
|
+
<div class="method-source-code" id="M000209-source">
|
218
224
|
<pre>
|
219
225
|
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 30</span>
|
220
226
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span>
|
@@ -227,7 +233,7 @@ Use the current renderer as returned by renderer or it’s short-cut r.
|
|
227
233
|
|
228
234
|
</div>
|
229
235
|
<div id="section">
|
230
|
-
<h2 class="section-title"><a name="
|
236
|
+
<h2 class="section-title"><a name="SEC00075">Callback</a></h2>
|
231
237
|
<div class="section-comment">
|
232
238
|
|
233
239
|
</div>
|
@@ -243,11 +249,11 @@ Use the current renderer as returned by renderer or it’s short-cut r.
|
|
243
249
|
<div id="methods">
|
244
250
|
<h3 class="section-bar">Public Instance methods</h3>
|
245
251
|
|
246
|
-
<div id="method-
|
247
|
-
<a name="
|
252
|
+
<div id="method-M000211" class="method-detail">
|
253
|
+
<a name="M000211"></a>
|
248
254
|
|
249
255
|
<div class="method-heading">
|
250
|
-
<a href="#
|
256
|
+
<a href="#M000211" class="method-signature">
|
251
257
|
<span class="method-name">process_callbacks</span><span class="method-args">(callback_stream)</span>
|
252
258
|
</a>
|
253
259
|
</div>
|
@@ -267,8 +273,8 @@ processed/invoked before any of the action callbacks are processed/invoked.
|
|
267
273
|
</dd>
|
268
274
|
</dl>
|
269
275
|
<p><a class="source-toggle" href="#"
|
270
|
-
onclick="toggleCode('
|
271
|
-
<div class="method-source-code" id="
|
276
|
+
onclick="toggleCode('M000211-source');return false;">[Source]</a></p>
|
277
|
+
<div class="method-source-code" id="M000211-source">
|
272
278
|
<pre>
|
273
279
|
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 59</span>
|
274
280
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_callbacks</span>(<span class="ruby-identifier">callback_stream</span>)
|
@@ -284,11 +290,11 @@ processed/invoked before any of the action callbacks are processed/invoked.
|
|
284
290
|
</div>
|
285
291
|
</div>
|
286
292
|
|
287
|
-
<div id="method-
|
288
|
-
<a name="
|
293
|
+
<div id="method-M000210" class="method-detail">
|
294
|
+
<a name="M000210"></a>
|
289
295
|
|
290
296
|
<div class="method-heading">
|
291
|
-
<a href="#
|
297
|
+
<a href="#M000210" class="method-signature">
|
292
298
|
<span class="method-name">process_callbacks_chain</span><span class="method-args">(callback_stream)</span>
|
293
299
|
</a>
|
294
300
|
</div>
|
@@ -296,7 +302,7 @@ processed/invoked before any of the action callbacks are processed/invoked.
|
|
296
302
|
<div class="method-description">
|
297
303
|
<p>
|
298
304
|
Starts processing the callbacks for the decoration chain by invoking method
|
299
|
-
<a href="Component.html#
|
305
|
+
<a href="Component.html#M000211">process_callbacks</a> of the first
|
300
306
|
decoration or the component itself if no decorations were specified.
|
301
307
|
</p>
|
302
308
|
<dl>
|
@@ -305,8 +311,8 @@ decoration or the component itself if no decorations were specified.
|
|
305
311
|
</dd>
|
306
312
|
</dl>
|
307
313
|
<p><a class="source-toggle" href="#"
|
308
|
-
onclick="toggleCode('
|
309
|
-
<div class="method-source-code" id="
|
314
|
+
onclick="toggleCode('M000210-source');return false;">[Source]</a></p>
|
315
|
+
<div class="method-source-code" id="M000210-source">
|
310
316
|
<pre>
|
311
317
|
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 46</span>
|
312
318
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_callbacks_chain</span>(<span class="ruby-identifier">callback_stream</span>)
|
@@ -320,7 +326,7 @@ decoration or the component itself if no decorations were specified.
|
|
320
326
|
|
321
327
|
</div>
|
322
328
|
<div id="section">
|
323
|
-
<h2 class="section-title"><a name="
|
329
|
+
<h2 class="section-title"><a name="SEC00076">Init</a></h2>
|
324
330
|
<div class="section-comment">
|
325
331
|
|
326
332
|
</div>
|
@@ -336,11 +342,11 @@ decoration or the component itself if no decorations were specified.
|
|
336
342
|
<div id="methods">
|
337
343
|
<h3 class="section-bar">Protected Instance methods</h3>
|
338
344
|
|
339
|
-
<div id="method-
|
340
|
-
<a name="
|
345
|
+
<div id="method-M000212" class="method-detail">
|
346
|
+
<a name="M000212"></a>
|
341
347
|
|
342
348
|
<div class="method-heading">
|
343
|
-
<a href="#
|
349
|
+
<a href="#M000212" class="method-signature">
|
344
350
|
<span class="method-name">initialize</span><span class="method-args">()</span>
|
345
351
|
</a>
|
346
352
|
</div>
|
@@ -354,8 +360,8 @@ Call this method from your own components’ <em>initialize</em> method
|
|
354
360
|
using <tt>super</tt>, before setting up anything else!
|
355
361
|
</p>
|
356
362
|
<p><a class="source-toggle" href="#"
|
357
|
-
onclick="toggleCode('
|
358
|
-
<div class="method-source-code" id="
|
363
|
+
onclick="toggleCode('M000212-source');return false;">[Source]</a></p>
|
364
|
+
<div class="method-source-code" id="M000212-source">
|
359
365
|
<pre>
|
360
366
|
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 79</span>
|
361
367
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>() <span class="ruby-comment cmt"># :notnew:</span>
|
@@ -370,7 +376,7 @@ using <tt>super</tt>, before setting up anything else!
|
|
370
376
|
|
371
377
|
</div>
|
372
378
|
<div id="section">
|
373
|
-
<h2 class="section-title"><a name="
|
379
|
+
<h2 class="section-title"><a name="SEC00077">Children</a></h2>
|
374
380
|
<div class="section-comment">
|
375
381
|
|
376
382
|
</div>
|
@@ -386,11 +392,11 @@ using <tt>super</tt>, before setting up anything else!
|
|
386
392
|
<div id="methods">
|
387
393
|
<h3 class="section-bar">Protected Instance methods</h3>
|
388
394
|
|
389
|
-
<div id="method-
|
390
|
-
<a name="
|
395
|
+
<div id="method-M000214" class="method-detail">
|
396
|
+
<a name="M000214"></a>
|
391
397
|
|
392
398
|
<div class="method-heading">
|
393
|
-
<a href="#
|
399
|
+
<a href="#M000214" class="method-signature">
|
394
400
|
<span class="method-name">add_child</span><span class="method-args">(child)</span>
|
395
401
|
</a>
|
396
402
|
</div>
|
@@ -419,23 +425,24 @@ course only if you want backtracking at all):
|
|
419
425
|
end
|
420
426
|
</pre>
|
421
427
|
<p><a class="source-toggle" href="#"
|
422
|
-
onclick="toggleCode('
|
423
|
-
<div class="method-source-code" id="
|
428
|
+
onclick="toggleCode('M000214-source');return false;">[Source]</a></p>
|
429
|
+
<div class="method-source-code" id="M000214-source">
|
424
430
|
<pre>
|
425
431
|
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 115</span>
|
426
432
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_child</span>(<span class="ruby-identifier">child</span>)
|
427
433
|
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">children</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">child</span>
|
434
|
+
<span class="ruby-identifier">child</span>
|
428
435
|
<span class="ruby-keyword kw">end</span>
|
429
436
|
</pre>
|
430
437
|
</div>
|
431
438
|
</div>
|
432
439
|
</div>
|
433
440
|
|
434
|
-
<div id="method-
|
435
|
-
<a name="
|
441
|
+
<div id="method-M000213" class="method-detail">
|
442
|
+
<a name="M000213"></a>
|
436
443
|
|
437
444
|
<div class="method-heading">
|
438
|
-
<a href="#
|
445
|
+
<a href="#M000213" class="method-signature">
|
439
446
|
<span class="method-name">children</span><span class="method-args">()</span>
|
440
447
|
</a>
|
441
448
|
</div>
|
@@ -445,8 +452,8 @@ course only if you want backtracking at all):
|
|
445
452
|
Returns all direct child components collected in an array.
|
446
453
|
</p>
|
447
454
|
<p><a class="source-toggle" href="#"
|
448
|
-
onclick="toggleCode('
|
449
|
-
<div class="method-source-code" id="
|
455
|
+
onclick="toggleCode('M000213-source');return false;">[Source]</a></p>
|
456
|
+
<div class="method-source-code" id="M000213-source">
|
450
457
|
<pre>
|
451
458
|
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 92</span>
|
452
459
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">children</span>
|
@@ -460,7 +467,7 @@ Returns all direct child components collected in an array.
|
|
460
467
|
|
461
468
|
</div>
|
462
469
|
<div id="section">
|
463
|
-
<h2 class="section-title"><a name="
|
470
|
+
<h2 class="section-title"><a name="SEC00078">Decoration</a></h2>
|
464
471
|
<div class="section-comment">
|
465
472
|
|
466
473
|
</div>
|
@@ -476,11 +483,11 @@ Returns all direct child components collected in an array.
|
|
476
483
|
<div id="methods">
|
477
484
|
<h3 class="section-bar">Public Instance methods</h3>
|
478
485
|
|
479
|
-
<div id="method-
|
480
|
-
<a name="
|
486
|
+
<div id="method-M000218" class="method-detail">
|
487
|
+
<a name="M000218"></a>
|
481
488
|
|
482
489
|
<div class="method-heading">
|
483
|
-
<a href="#
|
490
|
+
<a href="#M000218" class="method-signature">
|
484
491
|
<span class="method-name">add_decoration</span><span class="method-args">(d)</span>
|
485
492
|
</a>
|
486
493
|
</div>
|
@@ -495,10 +502,10 @@ decoration is added in front of all other local decorations but after all
|
|
495
502
|
global decorations.
|
496
503
|
</p>
|
497
504
|
<p><a class="source-toggle" href="#"
|
498
|
-
onclick="toggleCode('
|
499
|
-
<div class="method-source-code" id="
|
505
|
+
onclick="toggleCode('M000218-source');return false;">[Source]</a></p>
|
506
|
+
<div class="method-source-code" id="M000218-source">
|
500
507
|
<pre>
|
501
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
508
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 156</span>
|
502
509
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_decoration</span>(<span class="ruby-identifier">d</span>)
|
503
510
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">d</span>.<span class="ruby-identifier">global?</span>
|
504
511
|
<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>
|
@@ -528,11 +535,11 @@ global decorations.
|
|
528
535
|
</div>
|
529
536
|
</div>
|
530
537
|
|
531
|
-
<div id="method-
|
532
|
-
<a name="
|
538
|
+
<div id="method-M000215" class="method-detail">
|
539
|
+
<a name="M000215"></a>
|
533
540
|
|
534
541
|
<div class="method-heading">
|
535
|
-
<a href="#
|
542
|
+
<a href="#M000215" class="method-signature">
|
536
543
|
<span class="method-name">decoration</span><span class="method-args">()</span>
|
537
544
|
</a>
|
538
545
|
</div>
|
@@ -543,10 +550,10 @@ Returns the first decoration from the component’s decoration chain,
|
|
543
550
|
or <tt>self</tt> if no decorations were specified for the component.
|
544
551
|
</p>
|
545
552
|
<p><a class="source-toggle" href="#"
|
546
|
-
onclick="toggleCode('
|
547
|
-
<div class="method-source-code" id="
|
553
|
+
onclick="toggleCode('M000215-source');return false;">[Source]</a></p>
|
554
|
+
<div class="method-source-code" id="M000215-source">
|
548
555
|
<pre>
|
549
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
556
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 129</span>
|
550
557
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">decoration</span>
|
551
558
|
<span class="ruby-ivar">@decoration</span>.<span class="ruby-identifier">value</span>
|
552
559
|
<span class="ruby-keyword kw">end</span>
|
@@ -555,11 +562,11 @@ or <tt>self</tt> if no decorations were specified for the component.
|
|
555
562
|
</div>
|
556
563
|
</div>
|
557
564
|
|
558
|
-
<div id="method-
|
559
|
-
<a name="
|
565
|
+
<div id="method-M000216" class="method-detail">
|
566
|
+
<a name="M000216"></a>
|
560
567
|
|
561
568
|
<div class="method-heading">
|
562
|
-
<a href="#
|
569
|
+
<a href="#M000216" class="method-signature">
|
563
570
|
<span class="method-name">decoration=</span><span class="method-args">(d)</span>
|
564
571
|
</a>
|
565
572
|
</div>
|
@@ -569,10 +576,10 @@ or <tt>self</tt> if no decorations were specified for the component.
|
|
569
576
|
Set the pointer to the first decoration to <tt>d</tt>.
|
570
577
|
</p>
|
571
578
|
<p><a class="source-toggle" href="#"
|
572
|
-
onclick="toggleCode('
|
573
|
-
<div class="method-source-code" id="
|
579
|
+
onclick="toggleCode('M000216-source');return false;">[Source]</a></p>
|
580
|
+
<div class="method-source-code" id="M000216-source">
|
574
581
|
<pre>
|
575
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
582
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 135</span>
|
576
583
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">decoration=</span>(<span class="ruby-identifier">d</span>)
|
577
584
|
<span class="ruby-ivar">@decoration</span>.<span class="ruby-identifier">value</span> = <span class="ruby-identifier">d</span>
|
578
585
|
<span class="ruby-keyword kw">end</span>
|
@@ -581,11 +588,11 @@ Set the pointer to the first decoration to <tt>d</tt>.
|
|
581
588
|
</div>
|
582
589
|
</div>
|
583
590
|
|
584
|
-
<div id="method-
|
585
|
-
<a name="
|
591
|
+
<div id="method-M000217" class="method-detail">
|
592
|
+
<a name="M000217"></a>
|
586
593
|
|
587
594
|
<div class="method-heading">
|
588
|
-
<a href="#
|
595
|
+
<a href="#M000217" class="method-signature">
|
589
596
|
<span class="method-name">each_decoration</span><span class="method-args">( {|decoration| ...}</span>
|
590
597
|
</a>
|
591
598
|
</div>
|
@@ -595,10 +602,10 @@ Set the pointer to the first decoration to <tt>d</tt>.
|
|
595
602
|
Iterates over all decorations (note that the component itself is excluded).
|
596
603
|
</p>
|
597
604
|
<p><a class="source-toggle" href="#"
|
598
|
-
onclick="toggleCode('
|
599
|
-
<div class="method-source-code" id="
|
605
|
+
onclick="toggleCode('M000217-source');return false;">[Source]</a></p>
|
606
|
+
<div class="method-source-code" id="M000217-source">
|
600
607
|
<pre>
|
601
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
608
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 141</span>
|
602
609
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each_decoration</span> <span class="ruby-comment cmt"># :yields: decoration</span>
|
603
610
|
<span class="ruby-identifier">d</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">decoration</span>
|
604
611
|
<span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span>
|
@@ -612,11 +619,11 @@ Iterates over all decorations (note that the component itself is excluded).
|
|
612
619
|
</div>
|
613
620
|
</div>
|
614
621
|
|
615
|
-
<div id="method-
|
616
|
-
<a name="
|
622
|
+
<div id="method-M000219" class="method-detail">
|
623
|
+
<a name="M000219"></a>
|
617
624
|
|
618
625
|
<div class="method-heading">
|
619
|
-
<a href="#
|
626
|
+
<a href="#M000219" class="method-signature">
|
620
627
|
<span class="method-name">remove_decoration</span><span class="method-args">(d)</span>
|
621
628
|
</a>
|
622
629
|
</div>
|
@@ -630,10 +637,10 @@ Returns the removed decoration or <tt>nil</tt> if it did not exist in the
|
|
630
637
|
decoration chain.
|
631
638
|
</p>
|
632
639
|
<p><a class="source-toggle" href="#"
|
633
|
-
onclick="toggleCode('
|
634
|
-
<div class="method-source-code" id="
|
640
|
+
onclick="toggleCode('M000219-source');return false;">[Source]</a></p>
|
641
|
+
<div class="method-source-code" id="M000219-source">
|
635
642
|
<pre>
|
636
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
643
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 186</span>
|
637
644
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_decoration</span>(<span class="ruby-identifier">d</span>)
|
638
645
|
<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>
|
639
646
|
<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>
|
@@ -656,11 +663,11 @@ decoration chain.
|
|
656
663
|
</div>
|
657
664
|
</div>
|
658
665
|
|
659
|
-
<div id="method-
|
660
|
-
<a name="
|
666
|
+
<div id="method-M000220" class="method-detail">
|
667
|
+
<a name="M000220"></a>
|
661
668
|
|
662
669
|
<div class="method-heading">
|
663
|
-
<a href="#
|
670
|
+
<a href="#M000220" class="method-signature">
|
664
671
|
<span class="method-name">remove_decoration_if</span><span class="method-args">( {|decoration| ...}</span>
|
665
672
|
</a>
|
666
673
|
</div>
|
@@ -676,10 +683,10 @@ Example (removes all decorations of class <tt>HaloDecoration</tt>):
|
|
676
683
|
remove_decoration_if {|d| d.class == HaloDecoration}
|
677
684
|
</pre>
|
678
685
|
<p><a class="source-toggle" href="#"
|
679
|
-
onclick="toggleCode('
|
680
|
-
<div class="method-source-code" id="
|
686
|
+
onclick="toggleCode('M000220-source');return false;">[Source]</a></p>
|
687
|
+
<div class="method-source-code" id="M000220-source">
|
681
688
|
<pre>
|
682
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
689
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 211</span>
|
683
690
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_decoration_if</span> <span class="ruby-comment cmt"># :yields: decoration</span>
|
684
691
|
<span class="ruby-identifier">to_remove</span> = []
|
685
692
|
<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"><<</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>}
|
@@ -693,7 +700,7 @@ Example (removes all decorations of class <tt>HaloDecoration</tt>):
|
|
693
700
|
|
694
701
|
</div>
|
695
702
|
<div id="section">
|
696
|
-
<h2 class="section-title"><a name="
|
703
|
+
<h2 class="section-title"><a name="SEC00079">Backtrack</a></h2>
|
697
704
|
<div class="section-comment">
|
698
705
|
|
699
706
|
</div>
|
@@ -709,11 +716,11 @@ Example (removes all decorations of class <tt>HaloDecoration</tt>):
|
|
709
716
|
<div id="methods">
|
710
717
|
<h3 class="section-bar">Public Instance methods</h3>
|
711
718
|
|
712
|
-
<div id="method-
|
713
|
-
<a name="
|
719
|
+
<div id="method-M000222" class="method-detail">
|
720
|
+
<a name="M000222"></a>
|
714
721
|
|
715
722
|
<div class="method-heading">
|
716
|
-
<a href="#
|
723
|
+
<a href="#M000222" class="method-signature">
|
717
724
|
<span class="method-name">backtrack_state</span><span class="method-args">(snapshot)</span>
|
718
725
|
</a>
|
719
726
|
</div>
|
@@ -740,7 +747,7 @@ the decoration-object itself!).
|
|
740
747
|
<p>
|
741
748
|
For example if you dynamically add children to your component, you might
|
742
749
|
want to backtrack the children array. Therefore you simply pass it to the
|
743
|
-
<a href="Snapshot.html#
|
750
|
+
<a href="Snapshot.html#M000093">Snapshot#add</a> method:
|
744
751
|
</p>
|
745
752
|
<pre>
|
746
753
|
def backtrack_state(snapshot)
|
@@ -749,11 +756,11 @@ want to backtrack the children array. Therefore you simply pass it to the
|
|
749
756
|
end
|
750
757
|
</pre>
|
751
758
|
<p>
|
752
|
-
This will call <a href="../Array.html#
|
759
|
+
This will call <a href="../Array.html#M000005">Array#take_snapshot</a> to
|
753
760
|
take the snapshot for the children array. If at a later point in time a
|
754
761
|
snapshot is restored, <a
|
755
|
-
href="../Array.html#
|
756
|
-
the return value of <a href="../Array.html#
|
762
|
+
href="../Array.html#M000006">Array#restore_snapshot</a> will be called with
|
763
|
+
the return value of <a href="../Array.html#M000005">Array#take_snapshot</a>
|
757
764
|
as argument.
|
758
765
|
</p>
|
759
766
|
<dl>
|
@@ -762,10 +769,10 @@ as argument.
|
|
762
769
|
</dd>
|
763
770
|
</dl>
|
764
771
|
<p><a class="source-toggle" href="#"
|
765
|
-
onclick="toggleCode('
|
766
|
-
<div class="method-source-code" id="
|
772
|
+
onclick="toggleCode('M000222-source');return false;">[Source]</a></p>
|
773
|
+
<div class="method-source-code" id="M000222-source">
|
767
774
|
<pre>
|
768
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
775
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 268</span>
|
769
776
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">backtrack_state</span>(<span class="ruby-identifier">snapshot</span>)
|
770
777
|
<span class="ruby-identifier">snapshot</span>.<span class="ruby-identifier">add</span>(<span class="ruby-ivar">@decoration</span>)
|
771
778
|
<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>
|
@@ -775,11 +782,11 @@ as argument.
|
|
775
782
|
</div>
|
776
783
|
</div>
|
777
784
|
|
778
|
-
<div id="method-
|
779
|
-
<a name="
|
785
|
+
<div id="method-M000221" class="method-detail">
|
786
|
+
<a name="M000221"></a>
|
780
787
|
|
781
788
|
<div class="method-heading">
|
782
|
-
<a href="#
|
789
|
+
<a href="#M000221" class="method-signature">
|
783
790
|
<span class="method-name">backtrack_state_chain</span><span class="method-args">(snapshot)</span>
|
784
791
|
</a>
|
785
792
|
</div>
|
@@ -787,11 +794,11 @@ as argument.
|
|
787
794
|
<div class="method-description">
|
788
795
|
<p>
|
789
796
|
Starts the backtrack-state phase for the decoration chain, by invoking
|
790
|
-
method <a href="Component.html#
|
797
|
+
method <a href="Component.html#M000222">backtrack_state</a> of the first
|
791
798
|
decoration or the component itself if no decorations were specified.
|
792
799
|
</p>
|
793
800
|
<p>
|
794
|
-
See <a href="Component.html#
|
801
|
+
See <a href="Component.html#M000222">backtrack_state</a> for details.
|
795
802
|
</p>
|
796
803
|
<dl>
|
797
804
|
<dt><tt>snapshot</tt></dt><dd>An object of class <a href="Snapshot.html">Snapshot</a>
|
@@ -799,10 +806,10 @@ See <a href="Component.html#M000186">backtrack_state</a> for details.
|
|
799
806
|
</dd>
|
800
807
|
</dl>
|
801
808
|
<p><a class="source-toggle" href="#"
|
802
|
-
onclick="toggleCode('
|
803
|
-
<div class="method-source-code" id="
|
809
|
+
onclick="toggleCode('M000221-source');return false;">[Source]</a></p>
|
810
|
+
<div class="method-source-code" id="M000221-source">
|
804
811
|
<pre>
|
805
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
812
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 232</span>
|
806
813
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">backtrack_state_chain</span>(<span class="ruby-identifier">snapshot</span>)
|
807
814
|
<span class="ruby-identifier">decoration</span>.<span class="ruby-identifier">backtrack_state</span>(<span class="ruby-identifier">snapshot</span>)
|
808
815
|
<span class="ruby-keyword kw">end</span>
|
@@ -814,11 +821,17 @@ See <a href="Component.html#M000186">backtrack_state</a> for details.
|
|
814
821
|
|
815
822
|
</div>
|
816
823
|
<div id="section">
|
817
|
-
<h2 class="section-title"><a name="
|
824
|
+
<h2 class="section-title"><a name="SEC00080">Call/Answer</a></h2>
|
818
825
|
<div class="section-comment">
|
819
826
|
|
820
827
|
</div>
|
821
828
|
|
829
|
+
<div id="class-list">
|
830
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
831
|
+
|
832
|
+
Class <a href="Component/OnAnswer.html" class="link">Wee::Component::OnAnswer</a><br />
|
833
|
+
|
834
|
+
</div>
|
822
835
|
|
823
836
|
|
824
837
|
|
@@ -830,11 +843,11 @@ See <a href="Component.html#M000186">backtrack_state</a> for details.
|
|
830
843
|
<div id="methods">
|
831
844
|
<h3 class="section-bar">Protected Instance methods</h3>
|
832
845
|
|
833
|
-
<div id="method-
|
834
|
-
<a name="
|
846
|
+
<div id="method-M000224" class="method-detail">
|
847
|
+
<a name="M000224"></a>
|
835
848
|
|
836
849
|
<div class="method-heading">
|
837
|
-
<a href="#
|
850
|
+
<a href="#M000224" class="method-signature">
|
838
851
|
<span class="method-name">answer</span><span class="method-args">(*args)</span>
|
839
852
|
</a>
|
840
853
|
</div>
|
@@ -844,17 +857,17 @@ See <a href="Component.html#M000186">backtrack_state</a> for details.
|
|
844
857
|
Return from a called component.
|
845
858
|
</p>
|
846
859
|
<p>
|
847
|
-
NOTE that <a href="Component.html#
|
860
|
+
NOTE that <a href="Component.html#M000224">answer</a> never returns.
|
848
861
|
</p>
|
849
862
|
<p>
|
850
|
-
See <a href="Component.html#
|
863
|
+
See <a href="Component.html#M000223">call</a> for a detailed description of
|
851
864
|
the call/answer mechanism.
|
852
865
|
</p>
|
853
866
|
<p><a class="source-toggle" href="#"
|
854
|
-
onclick="toggleCode('
|
855
|
-
<div class="method-source-code" id="
|
867
|
+
onclick="toggleCode('M000224-source');return false;">[Source]</a></p>
|
868
|
+
<div class="method-source-code" id="M000224-source">
|
856
869
|
<pre>
|
857
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
870
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 346</span>
|
858
871
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">answer</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
859
872
|
<span class="ruby-identifier">throw</span> <span class="ruby-identifier">:wee_answer</span>, <span class="ruby-identifier">args</span>
|
860
873
|
<span class="ruby-keyword kw">end</span>
|
@@ -863,12 +876,86 @@ the call/answer mechanism.
|
|
863
876
|
</div>
|
864
877
|
</div>
|
865
878
|
|
866
|
-
<div id="method-
|
867
|
-
<a name="
|
879
|
+
<div id="method-M000223" class="method-detail">
|
880
|
+
<a name="M000223"></a>
|
881
|
+
|
882
|
+
<div class="method-heading">
|
883
|
+
<a href="#M000223" class="method-signature">
|
884
|
+
<span class="method-name">call</span><span class="method-args">(component, return_callback=nil, *additional_args)</span>
|
885
|
+
</a>
|
886
|
+
</div>
|
887
|
+
|
888
|
+
<div class="method-description">
|
889
|
+
<p>
|
890
|
+
The component to be called is wrapped with an <a
|
891
|
+
href="AnswerDecoration.html">AnswerDecoration</a> and the
|
892
|
+
<tt>return_callback</tt> parameter is assigned to it’s
|
893
|
+
<tt>on_answer</tt> attribute (not directly as there are cleanup actions to
|
894
|
+
be taken before the <tt>return_callback</tt> can be invoked, hence we wrap
|
895
|
+
it in the <a href="Component/OnAnswer.html">OnAnswer</a> class). Then a <a
|
896
|
+
href="Delegate.html">Delegate</a> decoration is added to the calling
|
897
|
+
component (self), which delegates to the component to be called
|
898
|
+
(<tt>component</tt>).
|
899
|
+
</p>
|
900
|
+
<p>
|
901
|
+
Then we unwind the calling stack back to the <a
|
902
|
+
href="Session.html">Session</a> by throwing <em>:wee_back_to_session</em>.
|
903
|
+
This means, that there is only ever one action callback invoked per
|
904
|
+
request. This is not neccessary, we could simply omit this, but then
|
905
|
+
we’d break compatibility with the implementation using continuations.
|
906
|
+
</p>
|
907
|
+
<p>
|
908
|
+
When at a later point in time the called component invokes <a
|
909
|
+
href="Component.html#M000224">answer</a>, this will throw a
|
910
|
+
<em>:wee_answer</em> exception which is catched in the <a
|
911
|
+
href="AnswerDecoration.html">AnswerDecoration</a>. The <a
|
912
|
+
href="AnswerDecoration.html">AnswerDecoration</a> then invokes the
|
913
|
+
<tt>on_answer</tt> callback which cleans up the decorations we added during
|
914
|
+
<a href="Component.html#M000223">call</a>, and finally passes control to
|
915
|
+
the <tt>return_callback</tt>.
|
916
|
+
</p>
|
917
|
+
<p><a class="source-toggle" href="#"
|
918
|
+
onclick="toggleCode('M000223-source');return false;">[Source]</a></p>
|
919
|
+
<div class="method-source-code" id="M000223-source">
|
920
|
+
<pre>
|
921
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 317</span>
|
922
|
+
<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-keyword kw">nil</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">additional_args</span>)
|
923
|
+
<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>))
|
924
|
+
<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>)
|
925
|
+
<span class="ruby-identifier">answer</span>.<span class="ruby-identifier">on_answer</span> = <span class="ruby-constant">OnAnswer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">component</span>, <span class="ruby-identifier">delegate</span>, <span class="ruby-identifier">answer</span>,
|
926
|
+
<span class="ruby-identifier">return_callback</span>, <span class="ruby-identifier">additional_args</span>)
|
927
|
+
<span class="ruby-identifier">throw</span> <span class="ruby-identifier">:wee_back_to_session</span>
|
928
|
+
<span class="ruby-keyword kw">end</span>
|
929
|
+
</pre>
|
930
|
+
</div>
|
931
|
+
</div>
|
932
|
+
</div>
|
933
|
+
|
934
|
+
|
935
|
+
</div>
|
936
|
+
<div id="section">
|
937
|
+
<h2 class="section-title"><a name="SEC00120">Call/Answer</a></h2>
|
938
|
+
<div class="section-comment">
|
939
|
+
|
940
|
+
</div>
|
941
|
+
|
942
|
+
|
943
|
+
|
944
|
+
|
945
|
+
|
946
|
+
|
947
|
+
|
948
|
+
|
949
|
+
<!-- if method_list -->
|
950
|
+
<div id="methods">
|
951
|
+
<h3 class="section-bar">Protected Instance methods</h3>
|
952
|
+
|
953
|
+
<div id="method-M000225" class="method-detail">
|
954
|
+
<a name="M000225"></a>
|
868
955
|
|
869
956
|
<div class="method-heading">
|
870
|
-
<a href="#
|
871
|
-
<span class="method-name">call</span><span class="method-args">(component, return_callback=:use_continuation)</span>
|
957
|
+
<a href="#M000225" class="method-signature">
|
958
|
+
<span class="method-name">call</span><span class="method-args">(component, return_callback=:use_continuation, *additional_args)</span>
|
872
959
|
</a>
|
873
960
|
</div>
|
874
961
|
|
@@ -876,7 +963,7 @@ the call/answer mechanism.
|
|
876
963
|
<p>
|
877
964
|
Call another component. The calling component is neither rendered nor are
|
878
965
|
it’s callbacks processed until the called component answers using
|
879
|
-
method <a href="Component.html#
|
966
|
+
method <a href="Component.html#M000224">answer</a>.
|
880
967
|
</p>
|
881
968
|
<dl>
|
882
969
|
<dt><tt>component</tt></dt><dd>The component to be called.
|
@@ -896,15 +983,15 @@ calling component (self), which delegates to the component to be called
|
|
896
983
|
href="Session.html">Session</a> by throwing <em>:wee_back_to_session</em>.
|
897
984
|
This means, that there is only ever one action callback invoked per
|
898
985
|
request. When at a later point in time the called component invokes <a
|
899
|
-
href="Component.html#
|
986
|
+
href="Component.html#M000224">answer</a>, this will throw a
|
900
987
|
<em>:wee_answer</em> exception which is catched in the <a
|
901
988
|
href="AnswerDecoration.html">AnswerDecoration</a>. The <a
|
902
989
|
href="AnswerDecoration.html">AnswerDecoration</a> then jumps back to the
|
903
990
|
continuation we created at the beginning, and finally method <a
|
904
|
-
href="Component.html#
|
991
|
+
href="Component.html#M000223">call</a> returns.
|
905
992
|
</p>
|
906
993
|
<p>
|
907
|
-
Note that <a href="Component.html#
|
994
|
+
Note that <a href="Component.html#M000223">call</a> returns to an
|
908
995
|
"old" stack-frame from a previous request. That is why we throw
|
909
996
|
<em>:wee_back_to_session</em> after invoking an action callback, and
|
910
997
|
that’s why only ever one is invoked. We could remove this limitation
|
@@ -912,11 +999,11 @@ without problems, but then there would be a difference between those action
|
|
912
999
|
callbacks that call other components and those that do not.
|
913
1000
|
</p>
|
914
1001
|
<p><a class="source-toggle" href="#"
|
915
|
-
onclick="toggleCode('
|
916
|
-
<div class="method-source-code" id="
|
1002
|
+
onclick="toggleCode('M000225-source');return false;">[Source]</a></p>
|
1003
|
+
<div class="method-source-code" id="M000225-source">
|
917
1004
|
<pre>
|
918
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
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>)
|
1005
|
+
<span class="ruby-comment cmt"># File lib/wee/continuation/core/component.rb, line 36</span>
|
1006
|
+
<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>, <span class="ruby-operator">*</span><span class="ruby-identifier">additional_args</span>)
|
920
1007
|
<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>))
|
921
1008
|
<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>)
|
922
1009
|
|
@@ -929,12 +1016,8 @@ callbacks that call other components and those that do not.
|
|
929
1016
|
<span class="ruby-identifier">component</span>.<span class="ruby-identifier">remove_decoration</span>(<span class="ruby-identifier">answer</span>)
|
930
1017
|
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
|
931
1018
|
<span class="ruby-keyword kw">else</span>
|
932
|
-
<span class="ruby-
|
933
|
-
|
934
|
-
<span class="ruby-identifier">remove_decoration</span>(<span class="ruby-identifier">delegate</span>)
|
935
|
-
<span class="ruby-identifier">component</span>.<span class="ruby-identifier">remove_decoration</span>(<span class="ruby-identifier">answer</span>)
|
936
|
-
<span class="ruby-identifier">return_callback</span>.<span class="ruby-identifier">call</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
937
|
-
}
|
1019
|
+
<span class="ruby-identifier">answer</span>.<span class="ruby-identifier">on_answer</span> = <span class="ruby-constant">OnAnswer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">component</span>, <span class="ruby-identifier">delegate</span>, <span class="ruby-identifier">answer</span>,
|
1020
|
+
<span class="ruby-identifier">return_callback</span>, <span class="ruby-identifier">additional_args</span>)
|
938
1021
|
<span class="ruby-identifier">throw</span> <span class="ruby-identifier">:wee_back_to_session</span>
|
939
1022
|
<span class="ruby-keyword kw">end</span>
|
940
1023
|
<span class="ruby-keyword kw">end</span>
|