wee 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +286 -0
- data/Features +185 -0
- data/doc/rdoc/classes/ActionView.html +107 -0
- data/doc/rdoc/classes/ActionView/Base.html +133 -0
- data/doc/rdoc/classes/Array.html +7 -59
- 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/Hash.html +120 -0
- data/doc/rdoc/classes/Main.html +58 -34
- data/doc/rdoc/classes/Object.html +12 -12
- data/doc/rdoc/classes/OgScaffolder.html +165 -166
- data/doc/rdoc/classes/OgScaffolder/Editor.html +112 -112
- data/doc/rdoc/classes/String.html +7 -59
- data/doc/rdoc/classes/Struct.html +14 -14
- data/doc/rdoc/classes/Wee.html +70 -6
- data/doc/rdoc/classes/Wee/AbstractSession.html +502 -0
- data/doc/rdoc/classes/Wee/AnswerDecoration.html +11 -11
- data/doc/rdoc/classes/Wee/Application.html +139 -84
- data/doc/rdoc/classes/Wee/Brush.html +21 -18
- data/doc/rdoc/classes/Wee/Brush/AnchorTag.html +90 -17
- data/doc/rdoc/classes/Wee/Brush/CheckboxTag.html +162 -0
- data/doc/rdoc/classes/Wee/Brush/FileUploadTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/FormTag.html +41 -17
- data/doc/rdoc/classes/Wee/Brush/GenericEncodedTextBrush.html +12 -12
- data/doc/rdoc/classes/Wee/Brush/GenericSingleTagBrush.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/GenericTagBrush.html +112 -86
- data/doc/rdoc/classes/Wee/Brush/GenericTextBrush.html +12 -12
- data/doc/rdoc/classes/Wee/Brush/HiddenInputTag.html +160 -0
- data/doc/rdoc/classes/Wee/Brush/ImageButtonTag.html +15 -15
- data/doc/rdoc/classes/Wee/Brush/ImageTag.html +21 -21
- data/doc/rdoc/classes/Wee/Brush/InputTag.html +14 -14
- data/doc/rdoc/classes/Wee/Brush/JavascriptTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/Page.html +14 -14
- data/doc/rdoc/classes/Wee/Brush/RadioButtonTag.html +234 -0
- data/doc/rdoc/classes/Wee/Brush/RadioButtonTag/RadioGroup.html +207 -0
- data/doc/rdoc/classes/Wee/Brush/SelectListTag.html +124 -28
- data/doc/rdoc/classes/Wee/Brush/SelectListTag/SelectListCallback.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/SelectOptionTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/SubmitButtonTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/TableDataTag.html +14 -14
- data/doc/rdoc/classes/Wee/Brush/TableHeaderTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/TableRowTag.html +42 -42
- data/doc/rdoc/classes/Wee/Brush/TableTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/TextAreaTag.html +48 -15
- data/doc/rdoc/classes/Wee/Brush/TextInputTag.html +7 -7
- data/doc/rdoc/classes/Wee/CallbackRegistry.html +38 -38
- data/doc/rdoc/classes/Wee/CallbackStream.html +18 -18
- data/doc/rdoc/classes/Wee/CanvasMixin.html +225 -0
- data/doc/rdoc/classes/Wee/Component.html +202 -201
- data/doc/rdoc/classes/Wee/Component/OnAnswer.html +7 -7
- data/doc/rdoc/classes/Wee/ComponentDispatcher.html +289 -0
- data/doc/rdoc/classes/Wee/ComponentRunner.html +321 -0
- data/doc/rdoc/classes/Wee/Context.html +63 -3
- data/doc/rdoc/classes/Wee/Decoration.html +45 -45
- data/doc/rdoc/classes/Wee/Delegate.html +30 -30
- data/doc/rdoc/classes/Wee/DupReplaceSnapshotMixin.html +164 -0
- data/doc/rdoc/classes/Wee/ErrorResponse.html +16 -16
- data/doc/rdoc/classes/Wee/Examples.html +114 -0
- data/doc/rdoc/classes/Wee/Examples/Calculator.html +319 -0
- data/doc/rdoc/classes/Wee/Examples/Counter.html +289 -0
- data/doc/rdoc/classes/Wee/Examples/EditableCounter.html +210 -0
- data/doc/rdoc/classes/Wee/Examples/Window.html +346 -0
- data/doc/rdoc/classes/Wee/FastCGIAdaptor.html +227 -0
- data/doc/rdoc/classes/Wee/FormDecoration.html +6 -6
- data/doc/rdoc/classes/Wee/GenericResponse.html +7 -7
- data/doc/rdoc/classes/Wee/HtmlCanvasRenderer.html +1230 -0
- data/doc/rdoc/classes/Wee/HtmlWriter.html +40 -40
- data/doc/rdoc/classes/Wee/IdGenerator.html +148 -0
- data/doc/rdoc/classes/Wee/LiteralMethodCallback.html +27 -14
- data/doc/rdoc/classes/Wee/LoginDecoration.html +261 -0
- data/doc/rdoc/classes/Wee/Md5IdGenerator.html +14 -14
- data/doc/rdoc/classes/Wee/MessageBox.html +14 -14
- data/doc/rdoc/classes/Wee/Nitro.html +114 -0
- data/doc/rdoc/classes/Wee/Nitro/ControllerClassMixin.html +192 -0
- data/doc/rdoc/classes/Wee/Nitro/ControllerMixin.html +345 -0
- data/doc/rdoc/classes/Wee/Nitro/FormTag.html +155 -0
- data/doc/rdoc/classes/Wee/Nitro/HtmlCanvasRenderer.html +178 -0
- data/doc/rdoc/classes/Wee/Page.html +4 -0
- data/doc/rdoc/classes/Wee/PageDecoration.html +18 -18
- data/doc/rdoc/classes/Wee/PagelessApplication.html +13 -11
- data/doc/rdoc/classes/Wee/PagelessComponentDriver.html +296 -0
- data/doc/rdoc/classes/Wee/PagelessRequest.html +52 -21
- data/doc/rdoc/classes/Wee/PagelessSession.html +130 -91
- data/doc/rdoc/classes/Wee/Pager.html +534 -0
- data/doc/rdoc/classes/Wee/Presenter.html +482 -298
- data/doc/rdoc/classes/Wee/Rails.html +114 -0
- data/doc/rdoc/classes/Wee/Rails/ControllerClassMixin.html +192 -0
- data/doc/rdoc/classes/Wee/Rails/ControllerMixin.html +342 -0
- data/doc/rdoc/classes/Wee/Rails/FormTag.html +155 -0
- data/doc/rdoc/classes/Wee/Rails/HtmlCanvasRenderer.html +177 -0
- data/doc/rdoc/classes/Wee/RedirectResponse.html +7 -7
- data/doc/rdoc/classes/Wee/RefreshResponse.html +7 -7
- data/doc/rdoc/classes/Wee/Renderer.html +208 -0
- data/doc/rdoc/classes/Wee/RenderingContext.html +175 -3
- data/doc/rdoc/classes/Wee/Request.html +197 -46
- data/doc/rdoc/classes/Wee/RequestHandler.html +31 -31
- data/doc/rdoc/classes/Wee/Response.html +44 -43
- data/doc/rdoc/classes/Wee/Session.html +296 -402
- data/doc/rdoc/classes/Wee/SimpleIdGenerator.html +14 -14
- data/doc/rdoc/classes/Wee/Snapshot.html +19 -19
- data/doc/rdoc/classes/Wee/Utils.html +22 -22
- data/doc/rdoc/classes/Wee/Utils/LRUCache.html +6 -6
- data/doc/rdoc/classes/Wee/ValueHolder.html +19 -19
- data/doc/rdoc/classes/Wee/WEBrickAdaptor.html +72 -46
- data/doc/rdoc/classes/Wee/WrapperDecoration.html +6 -6
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/INSTALL.html +1 -1
- data/doc/rdoc/files/README.html +8 -12
- data/doc/rdoc/files/lib/cache/cache_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/abstractsession_rb.html +108 -0
- data/doc/rdoc/files/lib/wee/adaptors/fastcgi_rb.html +108 -0
- data/doc/rdoc/files/lib/wee/adaptors/nitro_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/adaptors/rails_rb.html +101 -0
- 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/component_dispatcher_rb.html +108 -0
- data/doc/rdoc/files/lib/wee/components/form_decoration_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/components/login_decoration_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/components/messagebox_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/components/page_decoration_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/components/pager_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/components/wrapper_decoration_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/components_rb.html +4 -1
- data/doc/rdoc/files/lib/wee/continuation/core/component_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/continuation/session_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/continuation_rb.html +1 -1
- 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/componentrunner_rb.html +110 -0
- data/doc/rdoc/files/lib/wee/core/context_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/core/decoration_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/core/idgen_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/core/page_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/core/presenter_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/core/renderer_rb.html +107 -0
- data/doc/rdoc/files/lib/wee/core/snapshot_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/core/valueholder_rb.html +2 -2
- data/doc/rdoc/files/lib/wee/core_ext_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/core_rb.html +7 -14
- data/doc/rdoc/files/lib/wee/databases/og/application_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/databases/og/old_scaffolder_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/databases/og/scaffolder_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/databases/og/session_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/databases/og_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/examples/calculator_rb.html +107 -0
- data/doc/rdoc/files/lib/wee/examples/counter_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/examples/editable_counter_rb.html +114 -0
- data/doc/rdoc/files/lib/wee/examples/window_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/idgen/md5_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/idgen/simple_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/page_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/pageless/application_rb.html +8 -1
- data/doc/rdoc/files/lib/wee/pageless/request_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/pageless/session_rb.html +2 -1
- data/doc/rdoc/files/lib/wee/pageless_rb.html +1 -1
- 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/request_rb.html +5 -4
- data/doc/rdoc/files/lib/wee/requesthandler_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/response_rb.html +2 -1
- data/doc/rdoc/files/lib/wee/session_rb.html +2 -3
- data/doc/rdoc/files/lib/wee/skeleton/og/components/main_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/skeleton/og/conf/db_rb.html +2 -2
- data/doc/rdoc/files/lib/wee/skeleton/og/models/recipe_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/skeleton/og/run_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/skeleton/simple/components/main_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/skeleton/simple/run_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/snapshot_ext_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/template_rb.html +1 -1
- 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 -1
- data/doc/rdoc/files/lib/wee/utils_rb.html +1 -1
- data/doc/rdoc/files/lib/wee_rb.html +5 -3
- data/doc/rdoc/fr_class_index.html +34 -2
- data/doc/rdoc/fr_file_index.html +17 -1
- data/doc/rdoc/fr_method_index.html +464 -314
- data/examples/ajax/ajax.rb +1 -1
- data/examples/demo.rb +47 -0
- data/examples/{calendar.rb → demo/calendar.rb} +89 -97
- data/examples/{example.rb → demo/example.rb} +17 -97
- data/examples/dispatcher.rb +37 -0
- data/examples/draw.rb +14 -11
- data/examples/nitro/run.rb +42 -0
- data/examples/radio.rb +44 -0
- data/examples/test.rb +3 -27
- data/lib/wee.rb +15 -3
- data/lib/wee/adaptors/nitro.rb +154 -0
- data/lib/wee/adaptors/rails.rb +154 -0
- data/lib/wee/application.rb +22 -20
- data/lib/wee/components.rb +3 -0
- data/lib/wee/components/component_dispatcher.rb +46 -0
- data/lib/wee/components/login_decoration.rb +35 -0
- data/lib/wee/components/messagebox.rb +2 -2
- data/lib/wee/components/pager.rb +102 -0
- data/lib/wee/continuation/core/component.rb +13 -12
- data/lib/wee/continuation/session.rb +11 -19
- data/lib/wee/core.rb +8 -7
- data/lib/wee/core/component.rb +8 -28
- data/lib/wee/core/componentrunner.rb +73 -0
- data/lib/wee/core/context.rb +27 -0
- data/lib/wee/core/idgen.rb +5 -0
- data/lib/wee/core/page.rb +1 -0
- data/lib/wee/core/presenter.rb +10 -126
- data/lib/wee/core/renderer.rb +23 -0
- data/lib/wee/core_ext.rb +122 -0
- data/lib/wee/databases/og/scaffolder.rb +0 -1
- data/lib/wee/examples/calculator.rb +70 -0
- data/lib/wee/examples/counter.rb +33 -0
- data/lib/wee/examples/editable_counter.rb +31 -0
- data/{examples → lib/wee/examples}/window.rb +29 -23
- data/lib/wee/idgen/md5.rb +1 -1
- data/lib/wee/idgen/simple.rb +1 -1
- data/lib/wee/pageless/session.rb +2 -3
- data/lib/wee/renderer/html/brushes.rb +142 -22
- data/lib/wee/renderer/html/canvas.rb +57 -19
- data/lib/wee/response.rb +3 -2
- data/lib/wee/session.rb +10 -54
- data/lib/wee/skeleton/og/components/main.rb +5 -1
- data/lib/wee/skeleton/og/conf/db.rb +1 -1
- data/lib/wee/snapshot_ext.rb +4 -10
- data/lib/wee/template.rb +19 -5
- data/lib/wee/utils/helper.rb +2 -2
- metadata +90 -13
- data/examples/calculator.rb +0 -67
- data/lib/wee/context.rb +0 -2
@@ -87,7 +87,7 @@
|
|
87
87
|
<div id="description">
|
88
88
|
<p>
|
89
89
|
The base class of all components. You should at least overwrite method <a
|
90
|
-
href="Component.html#
|
90
|
+
href="Component.html#M000326">render</a> in your own subclasses.
|
91
91
|
</p>
|
92
92
|
|
93
93
|
</div>
|
@@ -96,14 +96,14 @@ href="Component.html#M000254">render</a> in your own subclasses.
|
|
96
96
|
<div id="contents-list">
|
97
97
|
<h3 class="section-bar">Contents</h3>
|
98
98
|
<ul>
|
99
|
-
<li><a href="#
|
100
|
-
<li><a href="#
|
101
|
-
<li><a href="#
|
102
|
-
<li><a href="#
|
103
|
-
<li><a href="#
|
104
|
-
<li><a href="#
|
105
|
-
<li><a href="#
|
106
|
-
<li><a href="#
|
99
|
+
<li><a href="#SEC00080">Render</a></li>
|
100
|
+
<li><a href="#SEC00081">Callback</a></li>
|
101
|
+
<li><a href="#SEC00082">Init</a></li>
|
102
|
+
<li><a href="#SEC00083">Children/Composite</a></li>
|
103
|
+
<li><a href="#SEC00084">Decoration</a></li>
|
104
|
+
<li><a href="#SEC00085">Backtrack</a></li>
|
105
|
+
<li><a href="#SEC00086">Call/Answer</a></li>
|
106
|
+
<li><a href="#SEC00161">Call/Answer</a></li>
|
107
107
|
</ul>
|
108
108
|
</div>
|
109
109
|
|
@@ -111,24 +111,24 @@ href="Component.html#M000254">render</a> in your own subclasses.
|
|
111
111
|
<h3 class="section-bar">Methods</h3>
|
112
112
|
|
113
113
|
<div class="name-list">
|
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="#
|
126
|
-
<a href="#
|
127
|
-
<a href="#
|
128
|
-
<a href="#
|
129
|
-
<a href="#
|
130
|
-
<a href="#
|
131
|
-
<a href="#
|
114
|
+
<a href="#M000331">add_child</a>
|
115
|
+
<a href="#M000335">add_decoration</a>
|
116
|
+
<a href="#M000341">answer</a>
|
117
|
+
<a href="#M000339">backtrack_state</a>
|
118
|
+
<a href="#M000338">backtrack_state_chain</a>
|
119
|
+
<a href="#M000340">call</a>
|
120
|
+
<a href="#M000342">call</a>
|
121
|
+
<a href="#M000330">children</a>
|
122
|
+
<a href="#M000332">decoration</a>
|
123
|
+
<a href="#M000333">decoration=</a>
|
124
|
+
<a href="#M000325">do_render_chain</a>
|
125
|
+
<a href="#M000334">each_decoration</a>
|
126
|
+
<a href="#M000329">initialize</a>
|
127
|
+
<a href="#M000328">process_callbacks</a>
|
128
|
+
<a href="#M000327">process_callbacks_chain</a>
|
129
|
+
<a href="#M000336">remove_decoration</a>
|
130
|
+
<a href="#M000337">remove_decoration_if</a>
|
131
|
+
<a href="#M000326">render</a>
|
132
132
|
</div>
|
133
133
|
</div>
|
134
134
|
|
@@ -148,7 +148,7 @@ href="Component.html#M000254">render</a> in your own subclasses.
|
|
148
148
|
|
149
149
|
<!-- if method_list -->
|
150
150
|
<div id="section">
|
151
|
-
<h2 class="section-title"><a name="
|
151
|
+
<h2 class="section-title"><a name="SEC00080">Render</a></h2>
|
152
152
|
<div class="section-comment">
|
153
153
|
|
154
154
|
</div>
|
@@ -164,11 +164,11 @@ href="Component.html#M000254">render</a> in your own subclasses.
|
|
164
164
|
<div id="methods">
|
165
165
|
<h3 class="section-bar">Public Instance methods</h3>
|
166
166
|
|
167
|
-
<div id="method-
|
168
|
-
<a name="
|
167
|
+
<div id="method-M000325" class="method-detail">
|
168
|
+
<a name="M000325"></a>
|
169
169
|
|
170
170
|
<div class="method-heading">
|
171
|
-
<a href="#
|
171
|
+
<a href="#M000325" class="method-signature">
|
172
172
|
<span class="method-name">do_render_chain</span><span class="method-args">(rendering_context)</span>
|
173
173
|
</a>
|
174
174
|
</div>
|
@@ -176,7 +176,7 @@ href="Component.html#M000254">render</a> in your own subclasses.
|
|
176
176
|
<div class="method-description">
|
177
177
|
<p>
|
178
178
|
Starts rendering the decoration chain by calling method <a
|
179
|
-
href="Presenter.html#
|
179
|
+
href="Presenter.html#M000375">Presenter#do_render</a> for the first
|
180
180
|
decoration of the component, or calling <em>do_render</em> for the
|
181
181
|
component itself if no decorations were specified.
|
182
182
|
</p>
|
@@ -186,8 +186,8 @@ component itself if no decorations were specified.
|
|
186
186
|
</dd>
|
187
187
|
</dl>
|
188
188
|
<p><a class="source-toggle" href="#"
|
189
|
-
onclick="toggleCode('
|
190
|
-
<div class="method-source-code" id="
|
189
|
+
onclick="toggleCode('M000325-source');return false;">[Source]</a></p>
|
190
|
+
<div class="method-source-code" id="M000325-source">
|
191
191
|
<pre>
|
192
192
|
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 19</span>
|
193
193
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">do_render_chain</span>(<span class="ruby-identifier">rendering_context</span>)
|
@@ -198,11 +198,11 @@ component itself if no decorations were specified.
|
|
198
198
|
</div>
|
199
199
|
</div>
|
200
200
|
|
201
|
-
<div id="method-
|
202
|
-
<a name="
|
201
|
+
<div id="method-M000326" class="method-detail">
|
202
|
+
<a name="M000326"></a>
|
203
203
|
|
204
204
|
<div class="method-heading">
|
205
|
-
<a href="#
|
205
|
+
<a href="#M000326" class="method-signature">
|
206
206
|
<span class="method-name">render</span><span class="method-args">()</span>
|
207
207
|
</a>
|
208
208
|
</div>
|
@@ -219,8 +219,8 @@ view. By default this method does nothing!
|
|
219
219
|
Use the current renderer as returned by renderer or it’s short-cut r.
|
220
220
|
</p>
|
221
221
|
<p><a class="source-toggle" href="#"
|
222
|
-
onclick="toggleCode('
|
223
|
-
<div class="method-source-code" id="
|
222
|
+
onclick="toggleCode('M000326-source');return false;">[Source]</a></p>
|
223
|
+
<div class="method-source-code" id="M000326-source">
|
224
224
|
<pre>
|
225
225
|
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 30</span>
|
226
226
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span>
|
@@ -233,7 +233,7 @@ Use the current renderer as returned by renderer or it’s short-cut r.
|
|
233
233
|
|
234
234
|
</div>
|
235
235
|
<div id="section">
|
236
|
-
<h2 class="section-title"><a name="
|
236
|
+
<h2 class="section-title"><a name="SEC00081">Callback</a></h2>
|
237
237
|
<div class="section-comment">
|
238
238
|
|
239
239
|
</div>
|
@@ -249,12 +249,12 @@ Use the current renderer as returned by renderer or it’s short-cut r.
|
|
249
249
|
<div id="methods">
|
250
250
|
<h3 class="section-bar">Public Instance methods</h3>
|
251
251
|
|
252
|
-
<div id="method-
|
253
|
-
<a name="
|
252
|
+
<div id="method-M000328" class="method-detail">
|
253
|
+
<a name="M000328"></a>
|
254
254
|
|
255
255
|
<div class="method-heading">
|
256
|
-
<a href="#
|
257
|
-
<span class="method-name">process_callbacks</span><span class="method-args">(
|
256
|
+
<a href="#M000328" class="method-signature">
|
257
|
+
<span class="method-name">process_callbacks</span><span class="method-args">(&block)</span>
|
258
258
|
</a>
|
259
259
|
</div>
|
260
260
|
|
@@ -263,26 +263,23 @@ Use the current renderer as returned by renderer or it’s short-cut r.
|
|
263
263
|
Process and invoke all callbacks specified for this component and all of
|
264
264
|
it’s child components.
|
265
265
|
</p>
|
266
|
-
<p>
|
267
|
-
All input callbacks of this component and it’s child components are
|
268
|
-
processed/invoked before any of the action callbacks are processed/invoked.
|
269
|
-
</p>
|
270
266
|
<dl>
|
271
|
-
<dt><tt>
|
267
|
+
<dt><tt>block</tt></dt><dd>Specifies the action to be taken (e.g. whether to invoke input or action
|
268
|
+
callbacks).
|
272
269
|
|
273
270
|
</dd>
|
274
271
|
</dl>
|
275
272
|
<p><a class="source-toggle" href="#"
|
276
|
-
onclick="toggleCode('
|
277
|
-
<div class="method-source-code" id="
|
273
|
+
onclick="toggleCode('M000328-source');return false;">[Source]</a></p>
|
274
|
+
<div class="method-source-code" id="M000328-source">
|
278
275
|
<pre>
|
279
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
280
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_callbacks</span>(<span class="ruby-identifier">
|
281
|
-
<span class="ruby-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
<span class="ruby-
|
276
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 58</span>
|
277
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_callbacks</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
278
|
+
<span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-keyword kw">self</span>)
|
279
|
+
|
280
|
+
<span class="ruby-comment cmt"># process callbacks of all children</span>
|
281
|
+
<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>
|
282
|
+
<span class="ruby-identifier">child</span>.<span class="ruby-identifier">process_callbacks_chain</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
286
283
|
<span class="ruby-keyword kw">end</span>
|
287
284
|
<span class="ruby-keyword kw">end</span>
|
288
285
|
</pre>
|
@@ -290,33 +287,34 @@ processed/invoked before any of the action callbacks are processed/invoked.
|
|
290
287
|
</div>
|
291
288
|
</div>
|
292
289
|
|
293
|
-
<div id="method-
|
294
|
-
<a name="
|
290
|
+
<div id="method-M000327" class="method-detail">
|
291
|
+
<a name="M000327"></a>
|
295
292
|
|
296
293
|
<div class="method-heading">
|
297
|
-
<a href="#
|
298
|
-
<span class="method-name">process_callbacks_chain</span><span class="method-args">(
|
294
|
+
<a href="#M000327" class="method-signature">
|
295
|
+
<span class="method-name">process_callbacks_chain</span><span class="method-args">(&block)</span>
|
299
296
|
</a>
|
300
297
|
</div>
|
301
298
|
|
302
299
|
<div class="method-description">
|
303
300
|
<p>
|
304
301
|
Starts processing the callbacks for the decoration chain by invoking method
|
305
|
-
<a href="Component.html#
|
302
|
+
<a href="Component.html#M000328">process_callbacks</a> of the first
|
306
303
|
decoration or the component itself if no decorations were specified.
|
307
304
|
</p>
|
308
305
|
<dl>
|
309
|
-
<dt><tt>
|
306
|
+
<dt><tt>block</tt></dt><dd>Specifies the action to be taken (e.g. whether to invoke input or action
|
307
|
+
callbacks).
|
310
308
|
|
311
309
|
</dd>
|
312
310
|
</dl>
|
313
311
|
<p><a class="source-toggle" href="#"
|
314
|
-
onclick="toggleCode('
|
315
|
-
<div class="method-source-code" id="
|
312
|
+
onclick="toggleCode('M000327-source');return false;">[Source]</a></p>
|
313
|
+
<div class="method-source-code" id="M000327-source">
|
316
314
|
<pre>
|
317
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
318
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_callbacks_chain</span>(<span class="ruby-identifier">
|
319
|
-
<span class="ruby-identifier">decoration</span>.<span class="ruby-identifier">process_callbacks</span>(<span class="ruby-identifier">
|
315
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 47</span>
|
316
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_callbacks_chain</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
317
|
+
<span class="ruby-identifier">decoration</span>.<span class="ruby-identifier">process_callbacks</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
320
318
|
<span class="ruby-keyword kw">end</span>
|
321
319
|
</pre>
|
322
320
|
</div>
|
@@ -326,7 +324,7 @@ decoration or the component itself if no decorations were specified.
|
|
326
324
|
|
327
325
|
</div>
|
328
326
|
<div id="section">
|
329
|
-
<h2 class="section-title"><a name="
|
327
|
+
<h2 class="section-title"><a name="SEC00082">Init</a></h2>
|
330
328
|
<div class="section-comment">
|
331
329
|
|
332
330
|
</div>
|
@@ -342,11 +340,11 @@ decoration or the component itself if no decorations were specified.
|
|
342
340
|
<div id="methods">
|
343
341
|
<h3 class="section-bar">Protected Instance methods</h3>
|
344
342
|
|
345
|
-
<div id="method-
|
346
|
-
<a name="
|
343
|
+
<div id="method-M000329" class="method-detail">
|
344
|
+
<a name="M000329"></a>
|
347
345
|
|
348
346
|
<div class="method-heading">
|
349
|
-
<a href="#
|
347
|
+
<a href="#M000329" class="method-signature">
|
350
348
|
<span class="method-name">initialize</span><span class="method-args">()</span>
|
351
349
|
</a>
|
352
350
|
</div>
|
@@ -360,13 +358,13 @@ Call this method from your own components’ <em>initialize</em> method
|
|
360
358
|
using <tt>super</tt>, before setting up anything else!
|
361
359
|
</p>
|
362
360
|
<p><a class="source-toggle" href="#"
|
363
|
-
onclick="toggleCode('
|
364
|
-
<div class="method-source-code" id="
|
361
|
+
onclick="toggleCode('M000329-source');return false;">[Source]</a></p>
|
362
|
+
<div class="method-source-code" id="M000329-source">
|
365
363
|
<pre>
|
366
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
364
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 78</span>
|
367
365
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>() <span class="ruby-comment cmt"># :notnew:</span>
|
368
|
-
<span class="ruby-ivar">@
|
369
|
-
<span class="ruby-ivar">@
|
366
|
+
<span class="ruby-ivar">@__decoration</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">ValueHolder</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>)
|
367
|
+
<span class="ruby-ivar">@__children</span> = []
|
370
368
|
<span class="ruby-keyword kw">end</span>
|
371
369
|
</pre>
|
372
370
|
</div>
|
@@ -376,7 +374,7 @@ using <tt>super</tt>, before setting up anything else!
|
|
376
374
|
|
377
375
|
</div>
|
378
376
|
<div id="section">
|
379
|
-
<h2 class="section-title"><a name="
|
377
|
+
<h2 class="section-title"><a name="SEC00083">Children/Composite</a></h2>
|
380
378
|
<div class="section-comment">
|
381
379
|
|
382
380
|
</div>
|
@@ -392,11 +390,11 @@ using <tt>super</tt>, before setting up anything else!
|
|
392
390
|
<div id="methods">
|
393
391
|
<h3 class="section-bar">Protected Instance methods</h3>
|
394
392
|
|
395
|
-
<div id="method-
|
396
|
-
<a name="
|
393
|
+
<div id="method-M000331" class="method-detail">
|
394
|
+
<a name="M000331"></a>
|
397
395
|
|
398
396
|
<div class="method-heading">
|
399
|
-
<a href="#
|
397
|
+
<a href="#M000331" class="method-signature">
|
400
398
|
<span class="method-name">add_child</span><span class="method-args">(child)</span>
|
401
399
|
</a>
|
402
400
|
</div>
|
@@ -425,10 +423,10 @@ course only if you want backtracking at all):
|
|
425
423
|
end
|
426
424
|
</pre>
|
427
425
|
<p><a class="source-toggle" href="#"
|
428
|
-
onclick="toggleCode('
|
429
|
-
<div class="method-source-code" id="
|
426
|
+
onclick="toggleCode('M000331-source');return false;">[Source]</a></p>
|
427
|
+
<div class="method-source-code" id="M000331-source">
|
430
428
|
<pre>
|
431
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
429
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 117</span>
|
432
430
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_child</span>(<span class="ruby-identifier">child</span>)
|
433
431
|
<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
432
|
<span class="ruby-identifier">child</span>
|
@@ -438,11 +436,11 @@ course only if you want backtracking at all):
|
|
438
436
|
</div>
|
439
437
|
</div>
|
440
438
|
|
441
|
-
<div id="method-
|
442
|
-
<a name="
|
439
|
+
<div id="method-M000330" class="method-detail">
|
440
|
+
<a name="M000330"></a>
|
443
441
|
|
444
442
|
<div class="method-heading">
|
445
|
-
<a href="#
|
443
|
+
<a href="#M000330" class="method-signature">
|
446
444
|
<span class="method-name">children</span><span class="method-args">()</span>
|
447
445
|
</a>
|
448
446
|
</div>
|
@@ -450,14 +448,18 @@ course only if you want backtracking at all):
|
|
450
448
|
<div class="method-description">
|
451
449
|
<p>
|
452
450
|
Returns all direct child components collected in an array.
|
451
|
+
</p>
|
452
|
+
<p>
|
453
|
+
You can overwrite this method to return all direct child components of this
|
454
|
+
component.
|
453
455
|
</p>
|
454
456
|
<p><a class="source-toggle" href="#"
|
455
|
-
onclick="toggleCode('
|
456
|
-
<div class="method-source-code" id="
|
457
|
+
onclick="toggleCode('M000330-source');return false;">[Source]</a></p>
|
458
|
+
<div class="method-source-code" id="M000330-source">
|
457
459
|
<pre>
|
458
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
460
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 94</span>
|
459
461
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">children</span>
|
460
|
-
<span class="ruby-ivar">@
|
462
|
+
<span class="ruby-ivar">@__children</span>
|
461
463
|
<span class="ruby-keyword kw">end</span>
|
462
464
|
</pre>
|
463
465
|
</div>
|
@@ -467,7 +469,7 @@ Returns all direct child components collected in an array.
|
|
467
469
|
|
468
470
|
</div>
|
469
471
|
<div id="section">
|
470
|
-
<h2 class="section-title"><a name="
|
472
|
+
<h2 class="section-title"><a name="SEC00084">Decoration</a></h2>
|
471
473
|
<div class="section-comment">
|
472
474
|
|
473
475
|
</div>
|
@@ -483,11 +485,11 @@ Returns all direct child components collected in an array.
|
|
483
485
|
<div id="methods">
|
484
486
|
<h3 class="section-bar">Public Instance methods</h3>
|
485
487
|
|
486
|
-
<div id="method-
|
487
|
-
<a name="
|
488
|
+
<div id="method-M000335" class="method-detail">
|
489
|
+
<a name="M000335"></a>
|
488
490
|
|
489
491
|
<div class="method-heading">
|
490
|
-
<a href="#
|
492
|
+
<a href="#M000335" class="method-signature">
|
491
493
|
<span class="method-name">add_decoration</span><span class="method-args">(d)</span>
|
492
494
|
</a>
|
493
495
|
</div>
|
@@ -505,10 +507,10 @@ global decorations.
|
|
505
507
|
Returns: <tt>self</tt>
|
506
508
|
</p>
|
507
509
|
<p><a class="source-toggle" href="#"
|
508
|
-
onclick="toggleCode('
|
509
|
-
<div class="method-source-code" id="
|
510
|
+
onclick="toggleCode('M000335-source');return false;">[Source]</a></p>
|
511
|
+
<div class="method-source-code" id="M000335-source">
|
510
512
|
<pre>
|
511
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
513
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 160</span>
|
512
514
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_decoration</span>(<span class="ruby-identifier">d</span>)
|
513
515
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">d</span>.<span class="ruby-identifier">global?</span>
|
514
516
|
<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>
|
@@ -540,11 +542,11 @@ Returns: <tt>self</tt>
|
|
540
542
|
</div>
|
541
543
|
</div>
|
542
544
|
|
543
|
-
<div id="method-
|
544
|
-
<a name="
|
545
|
+
<div id="method-M000332" class="method-detail">
|
546
|
+
<a name="M000332"></a>
|
545
547
|
|
546
548
|
<div class="method-heading">
|
547
|
-
<a href="#
|
549
|
+
<a href="#M000332" class="method-signature">
|
548
550
|
<span class="method-name">decoration</span><span class="method-args">()</span>
|
549
551
|
</a>
|
550
552
|
</div>
|
@@ -555,23 +557,23 @@ Returns the first decoration from the component’s decoration chain,
|
|
555
557
|
or <tt>self</tt> if no decorations were specified for the component.
|
556
558
|
</p>
|
557
559
|
<p><a class="source-toggle" href="#"
|
558
|
-
onclick="toggleCode('
|
559
|
-
<div class="method-source-code" id="
|
560
|
+
onclick="toggleCode('M000332-source');return false;">[Source]</a></p>
|
561
|
+
<div class="method-source-code" id="M000332-source">
|
560
562
|
<pre>
|
561
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
563
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 131</span>
|
562
564
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">decoration</span>
|
563
|
-
<span class="ruby-ivar">@
|
565
|
+
<span class="ruby-ivar">@__decoration</span>.<span class="ruby-identifier">value</span>
|
564
566
|
<span class="ruby-keyword kw">end</span>
|
565
567
|
</pre>
|
566
568
|
</div>
|
567
569
|
</div>
|
568
570
|
</div>
|
569
571
|
|
570
|
-
<div id="method-
|
571
|
-
<a name="
|
572
|
+
<div id="method-M000333" class="method-detail">
|
573
|
+
<a name="M000333"></a>
|
572
574
|
|
573
575
|
<div class="method-heading">
|
574
|
-
<a href="#
|
576
|
+
<a href="#M000333" class="method-signature">
|
575
577
|
<span class="method-name">decoration=</span><span class="method-args">(d)</span>
|
576
578
|
</a>
|
577
579
|
</div>
|
@@ -581,23 +583,23 @@ or <tt>self</tt> if no decorations were specified for the component.
|
|
581
583
|
Set the pointer to the first decoration to <tt>d</tt>.
|
582
584
|
</p>
|
583
585
|
<p><a class="source-toggle" href="#"
|
584
|
-
onclick="toggleCode('
|
585
|
-
<div class="method-source-code" id="
|
586
|
+
onclick="toggleCode('M000333-source');return false;">[Source]</a></p>
|
587
|
+
<div class="method-source-code" id="M000333-source">
|
586
588
|
<pre>
|
587
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
589
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 137</span>
|
588
590
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">decoration=</span>(<span class="ruby-identifier">d</span>)
|
589
|
-
<span class="ruby-ivar">@
|
591
|
+
<span class="ruby-ivar">@__decoration</span>.<span class="ruby-identifier">value</span> = <span class="ruby-identifier">d</span>
|
590
592
|
<span class="ruby-keyword kw">end</span>
|
591
593
|
</pre>
|
592
594
|
</div>
|
593
595
|
</div>
|
594
596
|
</div>
|
595
597
|
|
596
|
-
<div id="method-
|
597
|
-
<a name="
|
598
|
+
<div id="method-M000334" class="method-detail">
|
599
|
+
<a name="M000334"></a>
|
598
600
|
|
599
601
|
<div class="method-heading">
|
600
|
-
<a href="#
|
602
|
+
<a href="#M000334" class="method-signature">
|
601
603
|
<span class="method-name">each_decoration</span><span class="method-args">( {|decoration| ...}</span>
|
602
604
|
</a>
|
603
605
|
</div>
|
@@ -607,10 +609,10 @@ Set the pointer to the first decoration to <tt>d</tt>.
|
|
607
609
|
Iterates over all decorations (note that the component itself is excluded).
|
608
610
|
</p>
|
609
611
|
<p><a class="source-toggle" href="#"
|
610
|
-
onclick="toggleCode('
|
611
|
-
<div class="method-source-code" id="
|
612
|
+
onclick="toggleCode('M000334-source');return false;">[Source]</a></p>
|
613
|
+
<div class="method-source-code" id="M000334-source">
|
612
614
|
<pre>
|
613
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
615
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 143</span>
|
614
616
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each_decoration</span> <span class="ruby-comment cmt"># :yields: decoration</span>
|
615
617
|
<span class="ruby-identifier">d</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">decoration</span>
|
616
618
|
<span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span>
|
@@ -624,11 +626,11 @@ Iterates over all decorations (note that the component itself is excluded).
|
|
624
626
|
</div>
|
625
627
|
</div>
|
626
628
|
|
627
|
-
<div id="method-
|
628
|
-
<a name="
|
629
|
+
<div id="method-M000336" class="method-detail">
|
630
|
+
<a name="M000336"></a>
|
629
631
|
|
630
632
|
<div class="method-heading">
|
631
|
-
<a href="#
|
633
|
+
<a href="#M000336" class="method-signature">
|
632
634
|
<span class="method-name">remove_decoration</span><span class="method-args">(d)</span>
|
633
635
|
</a>
|
634
636
|
</div>
|
@@ -642,10 +644,10 @@ Returns the removed decoration or <tt>nil</tt> if it did not exist in the
|
|
642
644
|
decoration chain.
|
643
645
|
</p>
|
644
646
|
<p><a class="source-toggle" href="#"
|
645
|
-
onclick="toggleCode('
|
646
|
-
<div class="method-source-code" id="
|
647
|
+
onclick="toggleCode('M000336-source');return false;">[Source]</a></p>
|
648
|
+
<div class="method-source-code" id="M000336-source">
|
647
649
|
<pre>
|
648
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
650
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 192</span>
|
649
651
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_decoration</span>(<span class="ruby-identifier">d</span>)
|
650
652
|
<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>
|
651
653
|
<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>
|
@@ -668,11 +670,11 @@ decoration chain.
|
|
668
670
|
</div>
|
669
671
|
</div>
|
670
672
|
|
671
|
-
<div id="method-
|
672
|
-
<a name="
|
673
|
+
<div id="method-M000337" class="method-detail">
|
674
|
+
<a name="M000337"></a>
|
673
675
|
|
674
676
|
<div class="method-heading">
|
675
|
-
<a href="#
|
677
|
+
<a href="#M000337" class="method-signature">
|
676
678
|
<span class="method-name">remove_decoration_if</span><span class="method-args">( {|decoration| ...}</span>
|
677
679
|
</a>
|
678
680
|
</div>
|
@@ -688,10 +690,10 @@ Example (removes all decorations of class <tt>HaloDecoration</tt>):
|
|
688
690
|
remove_decoration_if {|d| d.class == HaloDecoration}
|
689
691
|
</pre>
|
690
692
|
<p><a class="source-toggle" href="#"
|
691
|
-
onclick="toggleCode('
|
692
|
-
<div class="method-source-code" id="
|
693
|
+
onclick="toggleCode('M000337-source');return false;">[Source]</a></p>
|
694
|
+
<div class="method-source-code" id="M000337-source">
|
693
695
|
<pre>
|
694
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
696
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 217</span>
|
695
697
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_decoration_if</span> <span class="ruby-comment cmt"># :yields: decoration</span>
|
696
698
|
<span class="ruby-identifier">to_remove</span> = []
|
697
699
|
<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>}
|
@@ -705,7 +707,7 @@ Example (removes all decorations of class <tt>HaloDecoration</tt>):
|
|
705
707
|
|
706
708
|
</div>
|
707
709
|
<div id="section">
|
708
|
-
<h2 class="section-title"><a name="
|
710
|
+
<h2 class="section-title"><a name="SEC00085">Backtrack</a></h2>
|
709
711
|
<div class="section-comment">
|
710
712
|
|
711
713
|
</div>
|
@@ -721,11 +723,11 @@ Example (removes all decorations of class <tt>HaloDecoration</tt>):
|
|
721
723
|
<div id="methods">
|
722
724
|
<h3 class="section-bar">Public Instance methods</h3>
|
723
725
|
|
724
|
-
<div id="method-
|
725
|
-
<a name="
|
726
|
+
<div id="method-M000339" class="method-detail">
|
727
|
+
<a name="M000339"></a>
|
726
728
|
|
727
729
|
<div class="method-heading">
|
728
|
-
<a href="#
|
730
|
+
<a href="#M000339" class="method-signature">
|
729
731
|
<span class="method-name">backtrack_state</span><span class="method-args">(snapshot)</span>
|
730
732
|
</a>
|
731
733
|
</div>
|
@@ -745,14 +747,14 @@ objects to take the snapshot (they behave like <em>marshal_dump</em> and
|
|
745
747
|
behaviour.
|
746
748
|
</p>
|
747
749
|
<p>
|
748
|
-
By default only <tt>@
|
749
|
-
href="ValueHolder.html">ValueHolder</a>, as only the pointer changes not
|
750
|
+
By default only <tt>@__decoration</tt> is backtracked (which actually is a
|
751
|
+
<a href="ValueHolder.html">ValueHolder</a>, as only the pointer changes not
|
750
752
|
the decoration-object itself!).
|
751
753
|
</p>
|
752
754
|
<p>
|
753
755
|
For example if you dynamically add children to your component, you might
|
754
756
|
want to backtrack the children array. Therefore you simply pass it to the
|
755
|
-
<a href="Snapshot.html#
|
757
|
+
<a href="Snapshot.html#M000259">Snapshot#add</a> method:
|
756
758
|
</p>
|
757
759
|
<pre>
|
758
760
|
def backtrack_state(snapshot)
|
@@ -761,12 +763,10 @@ want to backtrack the children array. Therefore you simply pass it to the
|
|
761
763
|
end
|
762
764
|
</pre>
|
763
765
|
<p>
|
764
|
-
This will call
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
the return value of <a href="../Array.html#M000010">Array#take_snapshot</a>
|
769
|
-
as argument.
|
766
|
+
This will call Array#take_snapshot to take the snapshot for the children
|
767
|
+
array. If at a later point in time a snapshot is restored,
|
768
|
+
Array#restore_snapshot will be called with the return value of
|
769
|
+
Array#take_snapshot as argument.
|
770
770
|
</p>
|
771
771
|
<dl>
|
772
772
|
<dt><tt>snapshot</tt></dt><dd>An object of class <a href="Snapshot.html">Snapshot</a>
|
@@ -774,12 +774,12 @@ as argument.
|
|
774
774
|
</dd>
|
775
775
|
</dl>
|
776
776
|
<p><a class="source-toggle" href="#"
|
777
|
-
onclick="toggleCode('
|
778
|
-
<div class="method-source-code" id="
|
777
|
+
onclick="toggleCode('M000339-source');return false;">[Source]</a></p>
|
778
|
+
<div class="method-source-code" id="M000339-source">
|
779
779
|
<pre>
|
780
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
780
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 274</span>
|
781
781
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">backtrack_state</span>(<span class="ruby-identifier">snapshot</span>)
|
782
|
-
<span class="ruby-identifier">snapshot</span>.<span class="ruby-identifier">add</span>(<span class="ruby-ivar">@
|
782
|
+
<span class="ruby-identifier">snapshot</span>.<span class="ruby-identifier">add</span>(<span class="ruby-ivar">@__decoration</span>)
|
783
783
|
<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>
|
784
784
|
<span class="ruby-keyword kw">end</span>
|
785
785
|
</pre>
|
@@ -787,11 +787,11 @@ as argument.
|
|
787
787
|
</div>
|
788
788
|
</div>
|
789
789
|
|
790
|
-
<div id="method-
|
791
|
-
<a name="
|
790
|
+
<div id="method-M000338" class="method-detail">
|
791
|
+
<a name="M000338"></a>
|
792
792
|
|
793
793
|
<div class="method-heading">
|
794
|
-
<a href="#
|
794
|
+
<a href="#M000338" class="method-signature">
|
795
795
|
<span class="method-name">backtrack_state_chain</span><span class="method-args">(snapshot)</span>
|
796
796
|
</a>
|
797
797
|
</div>
|
@@ -799,11 +799,11 @@ as argument.
|
|
799
799
|
<div class="method-description">
|
800
800
|
<p>
|
801
801
|
Starts the backtrack-state phase for the decoration chain, by invoking
|
802
|
-
method <a href="Component.html#
|
802
|
+
method <a href="Component.html#M000339">backtrack_state</a> of the first
|
803
803
|
decoration or the component itself if no decorations were specified.
|
804
804
|
</p>
|
805
805
|
<p>
|
806
|
-
See <a href="Component.html#
|
806
|
+
See <a href="Component.html#M000339">backtrack_state</a> for details.
|
807
807
|
</p>
|
808
808
|
<dl>
|
809
809
|
<dt><tt>snapshot</tt></dt><dd>An object of class <a href="Snapshot.html">Snapshot</a>
|
@@ -811,10 +811,10 @@ See <a href="Component.html#M000267">backtrack_state</a> for details.
|
|
811
811
|
</dd>
|
812
812
|
</dl>
|
813
813
|
<p><a class="source-toggle" href="#"
|
814
|
-
onclick="toggleCode('
|
815
|
-
<div class="method-source-code" id="
|
814
|
+
onclick="toggleCode('M000338-source');return false;">[Source]</a></p>
|
815
|
+
<div class="method-source-code" id="M000338-source">
|
816
816
|
<pre>
|
817
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
817
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 238</span>
|
818
818
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">backtrack_state_chain</span>(<span class="ruby-identifier">snapshot</span>)
|
819
819
|
<span class="ruby-identifier">decoration</span>.<span class="ruby-identifier">backtrack_state</span>(<span class="ruby-identifier">snapshot</span>)
|
820
820
|
<span class="ruby-keyword kw">end</span>
|
@@ -826,7 +826,7 @@ See <a href="Component.html#M000267">backtrack_state</a> for details.
|
|
826
826
|
|
827
827
|
</div>
|
828
828
|
<div id="section">
|
829
|
-
<h2 class="section-title"><a name="
|
829
|
+
<h2 class="section-title"><a name="SEC00086">Call/Answer</a></h2>
|
830
830
|
<div class="section-comment">
|
831
831
|
|
832
832
|
</div>
|
@@ -848,11 +848,11 @@ See <a href="Component.html#M000267">backtrack_state</a> for details.
|
|
848
848
|
<div id="methods">
|
849
849
|
<h3 class="section-bar">Protected Instance methods</h3>
|
850
850
|
|
851
|
-
<div id="method-
|
852
|
-
<a name="
|
851
|
+
<div id="method-M000341" class="method-detail">
|
852
|
+
<a name="M000341"></a>
|
853
853
|
|
854
854
|
<div class="method-heading">
|
855
|
-
<a href="#
|
855
|
+
<a href="#M000341" class="method-signature">
|
856
856
|
<span class="method-name">answer</span><span class="method-args">(*args)</span>
|
857
857
|
</a>
|
858
858
|
</div>
|
@@ -862,17 +862,17 @@ See <a href="Component.html#M000267">backtrack_state</a> for details.
|
|
862
862
|
Return from a called component.
|
863
863
|
</p>
|
864
864
|
<p>
|
865
|
-
NOTE that <a href="Component.html#
|
865
|
+
NOTE that <a href="Component.html#M000341">answer</a> never returns.
|
866
866
|
</p>
|
867
867
|
<p>
|
868
|
-
See <a href="Component.html#
|
868
|
+
See <a href="Component.html#M000340">call</a> for a detailed description of
|
869
869
|
the call/answer mechanism.
|
870
870
|
</p>
|
871
871
|
<p><a class="source-toggle" href="#"
|
872
|
-
onclick="toggleCode('
|
873
|
-
<div class="method-source-code" id="
|
872
|
+
onclick="toggleCode('M000341-source');return false;">[Source]</a></p>
|
873
|
+
<div class="method-source-code" id="M000341-source">
|
874
874
|
<pre>
|
875
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
875
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 352</span>
|
876
876
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">answer</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
877
877
|
<span class="ruby-identifier">throw</span> <span class="ruby-identifier">:wee_answer</span>, <span class="ruby-identifier">args</span>
|
878
878
|
<span class="ruby-keyword kw">end</span>
|
@@ -881,11 +881,11 @@ the call/answer mechanism.
|
|
881
881
|
</div>
|
882
882
|
</div>
|
883
883
|
|
884
|
-
<div id="method-
|
885
|
-
<a name="
|
884
|
+
<div id="method-M000340" class="method-detail">
|
885
|
+
<a name="M000340"></a>
|
886
886
|
|
887
887
|
<div class="method-heading">
|
888
|
-
<a href="#
|
888
|
+
<a href="#M000340" class="method-signature">
|
889
889
|
<span class="method-name">call</span><span class="method-args">(component, return_callback=nil, *args)</span>
|
890
890
|
</a>
|
891
891
|
</div>
|
@@ -894,14 +894,14 @@ the call/answer mechanism.
|
|
894
894
|
<p>
|
895
895
|
Call another component. The calling component is neither rendered nor are
|
896
896
|
it’s callbacks processed until the called component answers using
|
897
|
-
method <a href="Component.html#
|
897
|
+
method <a href="Component.html#M000341">answer</a>.
|
898
898
|
</p>
|
899
899
|
<dl>
|
900
900
|
<dt><tt>component</tt></dt><dd>The component to be called.
|
901
901
|
|
902
902
|
</dd>
|
903
903
|
<dt><tt>return_callback</tt></dt><dd>Is invoked when the called component answers. Either a symbol or any object
|
904
|
-
that responds to <a href="Component.html#
|
904
|
+
that responds to <a href="Component.html#M000340">call</a>. If it’s a
|
905
905
|
symbol, then the corresponding method of the current component will be
|
906
906
|
called.
|
907
907
|
|
@@ -927,32 +927,33 @@ component (self), which delegates to the component to be called
|
|
927
927
|
</p>
|
928
928
|
<p>
|
929
929
|
Then we unwind the calling stack back to the <a
|
930
|
-
href="Session.html">Session</a> by throwing
|
931
|
-
This means, that there is only
|
932
|
-
request. This is not neccessary, we
|
933
|
-
we’d break compatibility with the
|
930
|
+
href="Session.html">Session</a> by throwing
|
931
|
+
<em>:wee_abort_callback_processing</em>. This means, that there is only
|
932
|
+
ever one action callback invoked per request. This is not neccessary, we
|
933
|
+
could simply omit this, but then we’d break compatibility with the
|
934
|
+
implementation using continuations.
|
934
935
|
</p>
|
935
936
|
<p>
|
936
937
|
When at a later point in time the called component invokes <a
|
937
|
-
href="Component.html#
|
938
|
+
href="Component.html#M000341">answer</a>, this will throw a
|
938
939
|
<em>:wee_answer</em> exception which is catched in the <a
|
939
940
|
href="AnswerDecoration.html">AnswerDecoration</a>. The <a
|
940
941
|
href="AnswerDecoration.html">AnswerDecoration</a> then invokes the
|
941
942
|
<tt>on_answer</tt> callback which cleans up the decorations we added during
|
942
|
-
<a href="Component.html#
|
943
|
+
<a href="Component.html#M000340">call</a>, and finally passes control to
|
943
944
|
the <tt>return_callback</tt>.
|
944
945
|
</p>
|
945
946
|
<p><a class="source-toggle" href="#"
|
946
|
-
onclick="toggleCode('
|
947
|
-
<div class="method-source-code" id="
|
947
|
+
onclick="toggleCode('M000340-source');return false;">[Source]</a></p>
|
948
|
+
<div class="method-source-code" id="M000340-source">
|
948
949
|
<pre>
|
949
|
-
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line
|
950
|
+
<span class="ruby-comment cmt"># File lib/wee/core/component.rb, line 323</span>
|
950
951
|
<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">args</span>)
|
951
952
|
<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>))
|
952
953
|
<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>)
|
953
954
|
<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>,
|
954
955
|
<span class="ruby-identifier">return_callback</span>, <span class="ruby-identifier">args</span>)
|
955
|
-
<span class="ruby-identifier">throw</span> <span class="ruby-identifier">:
|
956
|
+
<span class="ruby-identifier">throw</span> <span class="ruby-identifier">:wee_abort_callback_processing</span>, <span class="ruby-keyword kw">nil</span>
|
956
957
|
<span class="ruby-keyword kw">end</span>
|
957
958
|
</pre>
|
958
959
|
</div>
|
@@ -962,7 +963,7 @@ the <tt>return_callback</tt>.
|
|
962
963
|
|
963
964
|
</div>
|
964
965
|
<div id="section">
|
965
|
-
<h2 class="section-title"><a name="
|
966
|
+
<h2 class="section-title"><a name="SEC00161">Call/Answer</a></h2>
|
966
967
|
<div class="section-comment">
|
967
968
|
|
968
969
|
</div>
|
@@ -978,11 +979,11 @@ the <tt>return_callback</tt>.
|
|
978
979
|
<div id="methods">
|
979
980
|
<h3 class="section-bar">Protected Instance methods</h3>
|
980
981
|
|
981
|
-
<div id="method-
|
982
|
-
<a name="
|
982
|
+
<div id="method-M000342" class="method-detail">
|
983
|
+
<a name="M000342"></a>
|
983
984
|
|
984
985
|
<div class="method-heading">
|
985
|
-
<a href="#
|
986
|
+
<a href="#M000342" class="method-signature">
|
986
987
|
<span class="method-name">call</span><span class="method-args">(component, return_callback=:use_continuation, *additional_args)</span>
|
987
988
|
</a>
|
988
989
|
</div>
|
@@ -991,7 +992,7 @@ the <tt>return_callback</tt>.
|
|
991
992
|
<p>
|
992
993
|
Call another component. The calling component is neither rendered nor are
|
993
994
|
it’s callbacks processed until the called component answers using
|
994
|
-
method <a href="Component.html#
|
995
|
+
method <a href="Component.html#M000341">answer</a>.
|
995
996
|
</p>
|
996
997
|
<dl>
|
997
998
|
<dt><tt>component</tt></dt><dd>The component to be called.
|
@@ -1008,29 +1009,29 @@ the continuation is assigned to it’s <tt>on_answer</tt> attribute.
|
|
1008
1009
|
Then a <a href="Delegate.html">Delegate</a> decoration is added to the
|
1009
1010
|
calling component (self), which delegates to the component to be called
|
1010
1011
|
(<tt>component</tt>). Then we unwind the calling stack back to the <a
|
1011
|
-
href="Session.html">Session</a> by throwing
|
1012
|
-
This means, that there is only
|
1013
|
-
request. When at a later point in time
|
1014
|
-
href="Component.html#
|
1015
|
-
<em>:wee_answer</em> exception which is catched in the <a
|
1012
|
+
href="Session.html">Session</a> by throwing
|
1013
|
+
<em>:wee_abort_callback_processing</em>. This means, that there is only
|
1014
|
+
ever one action callback invoked per request. When at a later point in time
|
1015
|
+
the called component invokes <a href="Component.html#M000341">answer</a>,
|
1016
|
+
this will throw a <em>:wee_answer</em> exception which is catched in the <a
|
1016
1017
|
href="AnswerDecoration.html">AnswerDecoration</a>. The <a
|
1017
1018
|
href="AnswerDecoration.html">AnswerDecoration</a> then jumps back to the
|
1018
1019
|
continuation we created at the beginning, and finally method <a
|
1019
|
-
href="Component.html#
|
1020
|
+
href="Component.html#M000340">call</a> returns.
|
1020
1021
|
</p>
|
1021
1022
|
<p>
|
1022
|
-
Note that <a href="Component.html#
|
1023
|
+
Note that <a href="Component.html#M000340">call</a> returns to an
|
1023
1024
|
"old" stack-frame from a previous request. That is why we throw
|
1024
|
-
<em>:
|
1025
|
-
that’s why only ever one is invoked. We could remove this
|
1026
|
-
without problems, but then there would be a difference between
|
1027
|
-
callbacks that call other components and those that do not.
|
1025
|
+
<em>:wee_abort_callback_processing</em> after invoking an action callback,
|
1026
|
+
and that’s why only ever one is invoked. We could remove this
|
1027
|
+
limitation without problems, but then there would be a difference between
|
1028
|
+
those action callbacks that call other components and those that do not.
|
1028
1029
|
</p>
|
1029
1030
|
<p><a class="source-toggle" href="#"
|
1030
|
-
onclick="toggleCode('
|
1031
|
-
<div class="method-source-code" id="
|
1031
|
+
onclick="toggleCode('M000342-source');return false;">[Source]</a></p>
|
1032
|
+
<div class="method-source-code" id="M000342-source">
|
1032
1033
|
<pre>
|
1033
|
-
<span class="ruby-comment cmt"># File lib/wee/continuation/core/component.rb, line
|
1034
|
+
<span class="ruby-comment cmt"># File lib/wee/continuation/core/component.rb, line 37</span>
|
1034
1035
|
<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>)
|
1035
1036
|
<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>))
|
1036
1037
|
<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>)
|
@@ -1038,7 +1039,7 @@ callbacks that call other components and those that do not.
|
|
1038
1039
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">return_callback</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:use_continuation</span>
|
1039
1040
|
<span class="ruby-identifier">result</span> = <span class="ruby-identifier">callcc</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">cc</span><span class="ruby-operator">|</span>
|
1040
1041
|
<span class="ruby-identifier">answer</span>.<span class="ruby-identifier">on_answer</span> = <span class="ruby-identifier">cc</span>
|
1041
|
-
<span class="ruby-identifier">throw</span> <span class="ruby-identifier">:
|
1042
|
+
<span class="ruby-identifier">throw</span> <span class="ruby-identifier">:wee_abort_callback_processing</span>, <span class="ruby-keyword kw">nil</span>
|
1042
1043
|
}
|
1043
1044
|
<span class="ruby-identifier">remove_decoration</span>(<span class="ruby-identifier">delegate</span>)
|
1044
1045
|
<span class="ruby-identifier">component</span>.<span class="ruby-identifier">remove_decoration</span>(<span class="ruby-identifier">answer</span>)
|
@@ -1046,7 +1047,7 @@ callbacks that call other components and those that do not.
|
|
1046
1047
|
<span class="ruby-keyword kw">else</span>
|
1047
1048
|
<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>,
|
1048
1049
|
<span class="ruby-identifier">return_callback</span>, <span class="ruby-identifier">additional_args</span>)
|
1049
|
-
<span class="ruby-identifier">throw</span> <span class="ruby-identifier">:
|
1050
|
+
<span class="ruby-identifier">throw</span> <span class="ruby-identifier">:wee_abort_callback_processing</span>, <span class="ruby-keyword kw">nil</span>
|
1050
1051
|
<span class="ruby-keyword kw">end</span>
|
1051
1052
|
<span class="ruby-keyword kw">end</span>
|
1052
1053
|
</pre>
|