wee 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +132 -0
- data/INSTALL +13 -3
- data/README +3 -3
- data/Rakefile +5 -1
- data/bin/wee +100 -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/Main.html +265 -0
- data/doc/rdoc/classes/Object.html +12 -12
- data/doc/rdoc/classes/OgApplication.html +2 -2
- data/doc/rdoc/classes/OgScaffolder.html +444 -64
- data/doc/rdoc/classes/OgScaffolder/Editor.html +490 -0
- data/doc/rdoc/classes/OgSession.html +4 -4
- data/doc/rdoc/classes/Recipe.html +113 -0
- data/doc/rdoc/classes/String.html +12 -12
- data/doc/rdoc/classes/Struct.html +12 -12
- data/doc/rdoc/classes/Wee.html +10 -1
- data/doc/rdoc/classes/Wee/AnswerDecoration.html +9 -9
- data/doc/rdoc/classes/Wee/Application.html +48 -47
- data/doc/rdoc/classes/Wee/Brush.html +19 -23
- data/doc/rdoc/classes/Wee/Brush/AnchorTag.html +17 -14
- data/doc/rdoc/classes/Wee/Brush/FileUploadTag.html +20 -14
- data/doc/rdoc/classes/Wee/Brush/FormTag.html +25 -21
- 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 +234 -100
- data/doc/rdoc/classes/Wee/Brush/GenericTextBrush.html +12 -12
- data/doc/rdoc/classes/Wee/Brush/ImageButtonTag.html +28 -22
- data/doc/rdoc/classes/Wee/Brush/ImageTag.html +23 -24
- 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/SelectListTag.html +33 -57
- data/doc/rdoc/classes/Wee/Brush/SelectListTag/SelectListCallback.html +154 -0
- data/doc/rdoc/classes/Wee/Brush/SelectOptionTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/SubmitButtonTag.html +20 -14
- 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 +27 -21
- data/doc/rdoc/classes/Wee/Brush/TextInputTag.html +20 -14
- data/doc/rdoc/classes/Wee/CallbackRegistry.html +64 -36
- data/doc/rdoc/classes/Wee/CallbackStream.html +21 -21
- data/doc/rdoc/classes/Wee/Canvas.html +24 -24
- data/doc/rdoc/classes/Wee/Component.html +179 -151
- data/doc/rdoc/classes/Wee/Component/OnAnswer.html +12 -12
- 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 +14 -14
- data/doc/rdoc/classes/Wee/FormDecoration.html +6 -6
- data/doc/rdoc/classes/Wee/GenericResponse.html +7 -7
- data/doc/rdoc/classes/Wee/HtmlCanvas.html +326 -219
- data/doc/rdoc/classes/Wee/HtmlWriter.html +40 -40
- data/doc/rdoc/classes/Wee/LiteralMethodCallback.html +19 -19
- data/doc/rdoc/classes/Wee/Md5IdGenerator.html +181 -0
- data/doc/rdoc/classes/Wee/MessageBox.html +12 -12
- data/doc/rdoc/classes/Wee/PageDecoration.html +18 -18
- data/doc/rdoc/classes/Wee/PagelessApplication.html +152 -0
- data/doc/rdoc/classes/Wee/PagelessRequest.html +177 -0
- data/doc/rdoc/classes/Wee/PagelessSession.html +320 -0
- data/doc/rdoc/classes/Wee/Presenter.html +145 -89
- data/doc/rdoc/classes/Wee/RedirectResponse.html +7 -7
- data/doc/rdoc/classes/Wee/RefreshResponse.html +7 -7
- data/doc/rdoc/classes/Wee/Request.html +116 -50
- data/doc/rdoc/classes/Wee/RequestHandler.html +31 -31
- data/doc/rdoc/classes/Wee/Response.html +76 -28
- data/doc/rdoc/classes/Wee/Session.html +129 -506
- data/doc/rdoc/classes/Wee/SimpleIdGenerator.html +22 -40
- data/doc/rdoc/classes/Wee/Snapshot.html +19 -19
- data/doc/rdoc/classes/Wee/Utils.html +70 -17
- data/doc/rdoc/classes/Wee/Utils/LRUCache.html +6 -6
- data/doc/rdoc/classes/Wee/ValueHolder.html +18 -18
- data/doc/rdoc/classes/Wee/WEBrickAdaptor.html +82 -49
- data/doc/rdoc/classes/Wee/WrapperDecoration.html +6 -6
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/INSTALL.html +17 -5
- data/doc/rdoc/files/README.html +9 -11
- 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/page_decoration_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/continuation/session_rb.html +1 -3
- 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_rb.html +3 -3
- data/doc/rdoc/files/lib/wee/databases/og/application_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/databases/og/old_scaffolder_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/databases/og/scaffolder_rb.html +108 -0
- data/doc/rdoc/files/lib/wee/databases/og/session_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/databases/og_rb.html +4 -1
- data/doc/rdoc/files/lib/wee/idgen/md5_rb.html +115 -0
- data/doc/rdoc/files/lib/wee/idgen/simple_rb.html +107 -0
- data/doc/rdoc/files/lib/wee/pageless/application_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/pageless/request_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/pageless/session_rb.html +108 -0
- data/doc/rdoc/files/lib/wee/pageless_rb.html +110 -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 +8 -1
- data/doc/rdoc/files/lib/wee/request_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/response_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/session_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/skeleton/og/components/main_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/skeleton/og/conf/db_rb.html +114 -0
- data/doc/rdoc/files/lib/wee/skeleton/og/models/recipe_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/skeleton/og/run_rb.html +115 -0
- data/doc/rdoc/files/lib/wee/skeleton/simple/components/main_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/skeleton/simple/run_rb.html +111 -0
- data/doc/rdoc/files/lib/wee/template_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/utils/autoreload_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/utils/helper_rb.html +1 -1
- data/doc/rdoc/files/lib/wee_rb.html +4 -2
- data/doc/rdoc/fr_class_index.html +8 -4
- data/doc/rdoc/fr_file_index.html +17 -1
- data/doc/rdoc/fr_method_index.html +312 -267
- data/examples/live-update.rb +1 -1
- data/install.rb +14 -0
- data/lib/wee.rb +6 -2
- data/lib/wee/adaptors/webrick.rb +17 -5
- data/lib/wee/application.rb +2 -1
- data/lib/wee/continuation/session.rb +1 -146
- data/lib/wee/core/callback.rb +11 -5
- data/lib/wee/core/component.rb +14 -10
- data/lib/wee/databases/og.rb +3 -113
- data/lib/wee/databases/og/application.rb +3 -0
- data/lib/wee/databases/og/old_scaffolder.rb +98 -0
- data/lib/wee/databases/og/scaffolder.rb +174 -0
- data/lib/wee/databases/og/session.rb +9 -0
- data/lib/wee/idgen/md5.rb +21 -0
- data/lib/wee/{idgen.rb → idgen/simple.rb} +2 -4
- data/lib/wee/pageless.rb +3 -0
- data/lib/wee/pageless/application.rb +9 -0
- data/lib/wee/pageless/request.rb +15 -0
- data/lib/wee/pageless/session.rb +89 -0
- data/lib/wee/renderer/html/brushes.rb +100 -115
- data/lib/wee/renderer/html/canvas.rb +32 -2
- data/lib/wee/request.rb +36 -24
- data/lib/wee/response.rb +8 -1
- data/lib/wee/session.rb +13 -7
- data/lib/wee/skeleton/og/README +38 -0
- data/lib/wee/skeleton/og/components/main.rb +16 -0
- data/lib/wee/skeleton/og/conf/db.rb +8 -0
- data/lib/wee/skeleton/og/models/recipe.rb +5 -0
- data/lib/wee/skeleton/og/run.rb +23 -0
- data/lib/wee/skeleton/simple/README +32 -0
- data/lib/wee/skeleton/simple/components/main.rb +25 -0
- data/lib/wee/skeleton/simple/run.rb +12 -0
- data/lib/wee/template.rb +28 -0
- data/lib/wee/utils/autoreload.rb +29 -0
- data/lib/wee/utils/helper.rb +9 -5
- data/test/test_request.rb +4 -3
- data/wee.gemspec +3 -1
- metadata +91 -22
|
@@ -88,10 +88,12 @@
|
|
|
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="#M000230"><<</a>
|
|
92
|
+
<a href="#M000228">content_type</a>
|
|
93
|
+
<a href="#M000229">content_type=</a>
|
|
94
|
+
<a href="#M000226">cookies</a>
|
|
95
|
+
<a href="#M000225">cookies?</a>
|
|
96
|
+
<a href="#M000227">new</a>
|
|
95
97
|
</div>
|
|
96
98
|
</div>
|
|
97
99
|
|
|
@@ -149,21 +151,21 @@
|
|
|
149
151
|
<div id="methods">
|
|
150
152
|
<h3 class="section-bar">Public Class methods</h3>
|
|
151
153
|
|
|
152
|
-
<div id="method-
|
|
153
|
-
<a name="
|
|
154
|
+
<div id="method-M000227" class="method-detail">
|
|
155
|
+
<a name="M000227"></a>
|
|
154
156
|
|
|
155
157
|
<div class="method-heading">
|
|
156
|
-
<a href="#
|
|
158
|
+
<a href="#M000227" class="method-signature">
|
|
157
159
|
<span class="method-name">new</span><span class="method-args">(mime_type = 'text/html', content='')</span>
|
|
158
160
|
</a>
|
|
159
161
|
</div>
|
|
160
162
|
|
|
161
163
|
<div class="method-description">
|
|
162
164
|
<p><a class="source-toggle" href="#"
|
|
163
|
-
onclick="toggleCode('
|
|
164
|
-
<div class="method-source-code" id="
|
|
165
|
+
onclick="toggleCode('M000227-source');return false;">[Source]</a></p>
|
|
166
|
+
<div class="method-source-code" id="M000227-source">
|
|
165
167
|
<pre>
|
|
166
|
-
<span class="ruby-comment cmt"># File lib/wee/response.rb, line
|
|
168
|
+
<span class="ruby-comment cmt"># File lib/wee/response.rb, line 17</span>
|
|
167
169
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">mime_type</span> = <span class="ruby-value str">'text/html'</span>, <span class="ruby-identifier">content</span>=<span class="ruby-value str">''</span>)
|
|
168
170
|
<span class="ruby-ivar">@status</span> = <span class="ruby-value">200</span>
|
|
169
171
|
<span class="ruby-ivar">@header</span> = <span class="ruby-constant">DEFAULT_HEADER</span>.<span class="ruby-identifier">dup</span>
|
|
@@ -176,21 +178,21 @@
|
|
|
176
178
|
|
|
177
179
|
<h3 class="section-bar">Public Instance methods</h3>
|
|
178
180
|
|
|
179
|
-
<div id="method-
|
|
180
|
-
<a name="
|
|
181
|
+
<div id="method-M000230" class="method-detail">
|
|
182
|
+
<a name="M000230"></a>
|
|
181
183
|
|
|
182
184
|
<div class="method-heading">
|
|
183
|
-
<a href="#
|
|
185
|
+
<a href="#M000230" class="method-signature">
|
|
184
186
|
<span class="method-name"><<</span><span class="method-args">(str)</span>
|
|
185
187
|
</a>
|
|
186
188
|
</div>
|
|
187
189
|
|
|
188
190
|
<div class="method-description">
|
|
189
191
|
<p><a class="source-toggle" href="#"
|
|
190
|
-
onclick="toggleCode('
|
|
191
|
-
<div class="method-source-code" id="
|
|
192
|
+
onclick="toggleCode('M000230-source');return false;">[Source]</a></p>
|
|
193
|
+
<div class="method-source-code" id="M000230-source">
|
|
192
194
|
<pre>
|
|
193
|
-
<span class="ruby-comment cmt"># File lib/wee/response.rb, line
|
|
195
|
+
<span class="ruby-comment cmt"># File lib/wee/response.rb, line 31</span>
|
|
194
196
|
<span class="ruby-keyword kw">def</span> <span class="ruby-operator"><<</span>(<span class="ruby-identifier">str</span>)
|
|
195
197
|
<span class="ruby-ivar">@content</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">str</span>
|
|
196
198
|
<span class="ruby-keyword kw">end</span>
|
|
@@ -199,21 +201,21 @@
|
|
|
199
201
|
</div>
|
|
200
202
|
</div>
|
|
201
203
|
|
|
202
|
-
<div id="method-
|
|
203
|
-
<a name="
|
|
204
|
+
<div id="method-M000228" class="method-detail">
|
|
205
|
+
<a name="M000228"></a>
|
|
204
206
|
|
|
205
207
|
<div class="method-heading">
|
|
206
|
-
<a href="#
|
|
208
|
+
<a href="#M000228" class="method-signature">
|
|
207
209
|
<span class="method-name">content_type</span><span class="method-args">()</span>
|
|
208
210
|
</a>
|
|
209
211
|
</div>
|
|
210
212
|
|
|
211
213
|
<div class="method-description">
|
|
212
214
|
<p><a class="source-toggle" href="#"
|
|
213
|
-
onclick="toggleCode('
|
|
214
|
-
<div class="method-source-code" id="
|
|
215
|
+
onclick="toggleCode('M000228-source');return false;">[Source]</a></p>
|
|
216
|
+
<div class="method-source-code" id="M000228-source">
|
|
215
217
|
<pre>
|
|
216
|
-
<span class="ruby-comment cmt"># File lib/wee/response.rb, line
|
|
218
|
+
<span class="ruby-comment cmt"># File lib/wee/response.rb, line 23</span>
|
|
217
219
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content_type</span>
|
|
218
220
|
<span class="ruby-ivar">@header</span>[<span class="ruby-value str">'Content-Type'</span>]
|
|
219
221
|
<span class="ruby-keyword kw">end</span>
|
|
@@ -222,21 +224,21 @@
|
|
|
222
224
|
</div>
|
|
223
225
|
</div>
|
|
224
226
|
|
|
225
|
-
<div id="method-
|
|
226
|
-
<a name="
|
|
227
|
+
<div id="method-M000229" class="method-detail">
|
|
228
|
+
<a name="M000229"></a>
|
|
227
229
|
|
|
228
230
|
<div class="method-heading">
|
|
229
|
-
<a href="#
|
|
231
|
+
<a href="#M000229" class="method-signature">
|
|
230
232
|
<span class="method-name">content_type=</span><span class="method-args">(mime_type)</span>
|
|
231
233
|
</a>
|
|
232
234
|
</div>
|
|
233
235
|
|
|
234
236
|
<div class="method-description">
|
|
235
237
|
<p><a class="source-toggle" href="#"
|
|
236
|
-
onclick="toggleCode('
|
|
237
|
-
<div class="method-source-code" id="
|
|
238
|
+
onclick="toggleCode('M000229-source');return false;">[Source]</a></p>
|
|
239
|
+
<div class="method-source-code" id="M000229-source">
|
|
238
240
|
<pre>
|
|
239
|
-
<span class="ruby-comment cmt"># File lib/wee/response.rb, line
|
|
241
|
+
<span class="ruby-comment cmt"># File lib/wee/response.rb, line 27</span>
|
|
240
242
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content_type=</span>(<span class="ruby-identifier">mime_type</span>)
|
|
241
243
|
<span class="ruby-ivar">@header</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-identifier">mime_type</span>
|
|
242
244
|
<span class="ruby-keyword kw">end</span>
|
|
@@ -245,6 +247,52 @@
|
|
|
245
247
|
</div>
|
|
246
248
|
</div>
|
|
247
249
|
|
|
250
|
+
<div id="method-M000226" class="method-detail">
|
|
251
|
+
<a name="M000226"></a>
|
|
252
|
+
|
|
253
|
+
<div class="method-heading">
|
|
254
|
+
<a href="#M000226" class="method-signature">
|
|
255
|
+
<span class="method-name">cookies</span><span class="method-args">()</span>
|
|
256
|
+
</a>
|
|
257
|
+
</div>
|
|
258
|
+
|
|
259
|
+
<div class="method-description">
|
|
260
|
+
<p><a class="source-toggle" href="#"
|
|
261
|
+
onclick="toggleCode('M000226-source');return false;">[Source]</a></p>
|
|
262
|
+
<div class="method-source-code" id="M000226-source">
|
|
263
|
+
<pre>
|
|
264
|
+
<span class="ruby-comment cmt"># File lib/wee/response.rb, line 13</span>
|
|
265
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cookies</span>
|
|
266
|
+
<span class="ruby-ivar">@cookies</span> <span class="ruby-operator">||=</span> []
|
|
267
|
+
<span class="ruby-keyword kw">end</span>
|
|
268
|
+
</pre>
|
|
269
|
+
</div>
|
|
270
|
+
</div>
|
|
271
|
+
</div>
|
|
272
|
+
|
|
273
|
+
<div id="method-M000225" class="method-detail">
|
|
274
|
+
<a name="M000225"></a>
|
|
275
|
+
|
|
276
|
+
<div class="method-heading">
|
|
277
|
+
<a href="#M000225" class="method-signature">
|
|
278
|
+
<span class="method-name">cookies?</span><span class="method-args">()</span>
|
|
279
|
+
</a>
|
|
280
|
+
</div>
|
|
281
|
+
|
|
282
|
+
<div class="method-description">
|
|
283
|
+
<p><a class="source-toggle" href="#"
|
|
284
|
+
onclick="toggleCode('M000225-source');return false;">[Source]</a></p>
|
|
285
|
+
<div class="method-source-code" id="M000225-source">
|
|
286
|
+
<pre>
|
|
287
|
+
<span class="ruby-comment cmt"># File lib/wee/response.rb, line 9</span>
|
|
288
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cookies?</span>
|
|
289
|
+
<span class="ruby-ivar">@cookies</span>
|
|
290
|
+
<span class="ruby-keyword kw">end</span>
|
|
291
|
+
</pre>
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|
|
294
|
+
</div>
|
|
295
|
+
|
|
248
296
|
|
|
249
297
|
</div>
|
|
250
298
|
|
|
@@ -90,7 +90,6 @@
|
|
|
90
90
|
<h3 class="section-bar">Contents</h3>
|
|
91
91
|
<ul>
|
|
92
92
|
<li><a href="#SEC00016">Properties</a></li>
|
|
93
|
-
<li><a href="#SEC00118">Properties</a></li>
|
|
94
93
|
</ul>
|
|
95
94
|
</div>
|
|
96
95
|
|
|
@@ -98,33 +97,23 @@
|
|
|
98
97
|
<h3 class="section-bar">Methods</h3>
|
|
99
98
|
|
|
100
99
|
<div class="name-list">
|
|
101
|
-
<a href="#
|
|
102
|
-
<a href="#
|
|
103
|
-
<a href="#
|
|
104
|
-
<a href="#
|
|
105
|
-
<a href="#
|
|
106
|
-
<a href="#
|
|
107
|
-
<a href="#
|
|
108
|
-
<a href="#
|
|
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="#M000162">new</a>
|
|
119
|
-
<a href="#M000155">process_request</a>
|
|
120
|
-
<a href="#M000169">process_request</a>
|
|
121
|
-
<a href="#M000160">respond</a>
|
|
122
|
-
<a href="#M000174">respond</a>
|
|
123
|
-
<a href="#M000168">sleep</a>
|
|
124
|
-
<a href="#M000154">sleep</a>
|
|
125
|
-
<a href="#M000150">snapshot</a>
|
|
126
|
-
<a href="#M000163">snapshot</a>
|
|
127
|
-
<a href="#M000165">start_request_response_loop</a>
|
|
100
|
+
<a href="#M000200">awake</a>
|
|
101
|
+
<a href="#M000199">create_page</a>
|
|
102
|
+
<a href="#M000195">current</a>
|
|
103
|
+
<a href="#M000204">current_callbacks</a>
|
|
104
|
+
<a href="#M000203">current_context</a>
|
|
105
|
+
<a href="#M000205">get_property</a>
|
|
106
|
+
<a href="#M000206">handle_new_page_view</a>
|
|
107
|
+
<a href="#M000198">handle_request</a>
|
|
108
|
+
<a href="#M000210">handle_request</a>
|
|
109
|
+
<a href="#M000196">new</a>
|
|
110
|
+
<a href="#M000209">new</a>
|
|
111
|
+
<a href="#M000202">process_request</a>
|
|
112
|
+
<a href="#M000208">respond</a>
|
|
113
|
+
<a href="#M000207">set_response</a>
|
|
114
|
+
<a href="#M000201">sleep</a>
|
|
115
|
+
<a href="#M000197">snapshot</a>
|
|
116
|
+
<a href="#M000211">start_request_response_loop</a>
|
|
128
117
|
</div>
|
|
129
118
|
</div>
|
|
130
119
|
|
|
@@ -164,19 +153,19 @@
|
|
|
164
153
|
<div id="methods">
|
|
165
154
|
<h3 class="section-bar">Public Class methods</h3>
|
|
166
155
|
|
|
167
|
-
<div id="method-
|
|
168
|
-
<a name="
|
|
156
|
+
<div id="method-M000195" class="method-detail">
|
|
157
|
+
<a name="M000195"></a>
|
|
169
158
|
|
|
170
159
|
<div class="method-heading">
|
|
171
|
-
<a href="#
|
|
160
|
+
<a href="#M000195" class="method-signature">
|
|
172
161
|
<span class="method-name">current</span><span class="method-args">()</span>
|
|
173
162
|
</a>
|
|
174
163
|
</div>
|
|
175
164
|
|
|
176
165
|
<div class="method-description">
|
|
177
166
|
<p><a class="source-toggle" href="#"
|
|
178
|
-
onclick="toggleCode('
|
|
179
|
-
<div class="method-source-code" id="
|
|
167
|
+
onclick="toggleCode('M000195-source');return false;">[Source]</a></p>
|
|
168
|
+
<div class="method-source-code" id="M000195-source">
|
|
180
169
|
<pre>
|
|
181
170
|
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 7</span>
|
|
182
171
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">current</span>
|
|
@@ -189,19 +178,19 @@
|
|
|
189
178
|
</div>
|
|
190
179
|
</div>
|
|
191
180
|
|
|
192
|
-
<div id="method-
|
|
193
|
-
<a name="
|
|
181
|
+
<div id="method-M000196" class="method-detail">
|
|
182
|
+
<a name="M000196"></a>
|
|
194
183
|
|
|
195
184
|
<div class="method-heading">
|
|
196
|
-
<a href="#
|
|
185
|
+
<a href="#M000196" class="method-signature">
|
|
197
186
|
<span class="method-name">new</span><span class="method-args">(&block)</span>
|
|
198
187
|
</a>
|
|
199
188
|
</div>
|
|
200
189
|
|
|
201
190
|
<div class="method-description">
|
|
202
191
|
<p><a class="source-toggle" href="#"
|
|
203
|
-
onclick="toggleCode('
|
|
204
|
-
<div class="method-source-code" id="
|
|
192
|
+
onclick="toggleCode('M000196-source');return false;">[Source]</a></p>
|
|
193
|
+
<div class="method-source-code" id="M000196-source">
|
|
205
194
|
<pre>
|
|
206
195
|
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 13</span>
|
|
207
196
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
|
@@ -230,23 +219,23 @@
|
|
|
230
219
|
|
|
231
220
|
<h3 class="section-bar">Public Instance methods</h3>
|
|
232
221
|
|
|
233
|
-
<div id="method-
|
|
234
|
-
<a name="
|
|
222
|
+
<div id="method-M000200" class="method-detail">
|
|
223
|
+
<a name="M000200"></a>
|
|
235
224
|
|
|
236
225
|
<div class="method-heading">
|
|
237
|
-
<a href="#
|
|
226
|
+
<a href="#M000200" class="method-signature">
|
|
238
227
|
<span class="method-name">awake</span><span class="method-args">()</span>
|
|
239
228
|
</a>
|
|
240
229
|
</div>
|
|
241
230
|
|
|
242
231
|
<div class="method-description">
|
|
243
232
|
<p>
|
|
244
|
-
Is called before <a href="Session.html#
|
|
233
|
+
Is called before <a href="Session.html#M000202">process_request</a> is
|
|
245
234
|
invoked Can be used to setup e.g. a database connection.
|
|
246
235
|
</p>
|
|
247
236
|
<p><a class="source-toggle" href="#"
|
|
248
|
-
onclick="toggleCode('
|
|
249
|
-
<div class="method-source-code" id="
|
|
237
|
+
onclick="toggleCode('M000200-source');return false;">[Source]</a></p>
|
|
238
|
+
<div class="method-source-code" id="M000200-source">
|
|
250
239
|
<pre>
|
|
251
240
|
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 66</span>
|
|
252
241
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">awake</span>
|
|
@@ -256,19 +245,19 @@ invoked Can be used to setup e.g. a database connection.
|
|
|
256
245
|
</div>
|
|
257
246
|
</div>
|
|
258
247
|
|
|
259
|
-
<div id="method-
|
|
260
|
-
<a name="
|
|
248
|
+
<div id="method-M000199" class="method-detail">
|
|
249
|
+
<a name="M000199"></a>
|
|
261
250
|
|
|
262
251
|
<div class="method-heading">
|
|
263
|
-
<a href="#
|
|
252
|
+
<a href="#M000199" class="method-signature">
|
|
264
253
|
<span class="method-name">create_page</span><span class="method-args">(snapshot)</span>
|
|
265
254
|
</a>
|
|
266
255
|
</div>
|
|
267
256
|
|
|
268
257
|
<div class="method-description">
|
|
269
258
|
<p><a class="source-toggle" href="#"
|
|
270
|
-
onclick="toggleCode('
|
|
271
|
-
<div class="method-source-code" id="
|
|
259
|
+
onclick="toggleCode('M000199-source');return false;">[Source]</a></p>
|
|
260
|
+
<div class="method-source-code" id="M000199-source">
|
|
272
261
|
<pre>
|
|
273
262
|
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 59</span>
|
|
274
263
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_page</span>(<span class="ruby-identifier">snapshot</span>)
|
|
@@ -280,57 +269,57 @@ invoked Can be used to setup e.g. a database connection.
|
|
|
280
269
|
</div>
|
|
281
270
|
</div>
|
|
282
271
|
|
|
283
|
-
<div id="method-
|
|
284
|
-
<a name="
|
|
272
|
+
<div id="method-M000204" class="method-detail">
|
|
273
|
+
<a name="M000204"></a>
|
|
285
274
|
|
|
286
275
|
<div class="method-heading">
|
|
287
|
-
<a href="#
|
|
288
|
-
<span class="method-name">
|
|
276
|
+
<a href="#M000204" class="method-signature">
|
|
277
|
+
<span class="method-name">current_callbacks</span><span class="method-args">()</span>
|
|
289
278
|
</a>
|
|
290
279
|
</div>
|
|
291
280
|
|
|
292
281
|
<div class="method-description">
|
|
293
282
|
<p><a class="source-toggle" href="#"
|
|
294
|
-
onclick="toggleCode('
|
|
295
|
-
<div class="method-source-code" id="
|
|
283
|
+
onclick="toggleCode('M000204-source');return false;">[Source]</a></p>
|
|
284
|
+
<div class="method-source-code" id="M000204-source">
|
|
296
285
|
<pre>
|
|
297
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
|
298
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
|
299
|
-
<span class="ruby-ivar">@
|
|
286
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 153</span>
|
|
287
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">current_callbacks</span>
|
|
288
|
+
<span class="ruby-ivar">@page</span>.<span class="ruby-identifier">callbacks</span>
|
|
300
289
|
<span class="ruby-keyword kw">end</span>
|
|
301
290
|
</pre>
|
|
302
291
|
</div>
|
|
303
292
|
</div>
|
|
304
293
|
</div>
|
|
305
294
|
|
|
306
|
-
<div id="method-
|
|
307
|
-
<a name="
|
|
295
|
+
<div id="method-M000203" class="method-detail">
|
|
296
|
+
<a name="M000203"></a>
|
|
308
297
|
|
|
309
298
|
<div class="method-heading">
|
|
310
|
-
<a href="#
|
|
311
|
-
<span class="method-name">
|
|
299
|
+
<a href="#M000203" class="method-signature">
|
|
300
|
+
<span class="method-name">current_context</span><span class="method-args">()</span>
|
|
312
301
|
</a>
|
|
313
302
|
</div>
|
|
314
303
|
|
|
315
304
|
<div class="method-description">
|
|
316
305
|
<p><a class="source-toggle" href="#"
|
|
317
|
-
onclick="toggleCode('
|
|
318
|
-
<div class="method-source-code" id="
|
|
306
|
+
onclick="toggleCode('M000203-source');return false;">[Source]</a></p>
|
|
307
|
+
<div class="method-source-code" id="M000203-source">
|
|
319
308
|
<pre>
|
|
320
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
|
321
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
|
322
|
-
<span class="ruby-ivar">@
|
|
309
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 149</span>
|
|
310
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">current_context</span>
|
|
311
|
+
<span class="ruby-ivar">@context</span>
|
|
323
312
|
<span class="ruby-keyword kw">end</span>
|
|
324
313
|
</pre>
|
|
325
314
|
</div>
|
|
326
315
|
</div>
|
|
327
316
|
</div>
|
|
328
317
|
|
|
329
|
-
<div id="method-
|
|
330
|
-
<a name="
|
|
318
|
+
<div id="method-M000198" class="method-detail">
|
|
319
|
+
<a name="M000198"></a>
|
|
331
320
|
|
|
332
321
|
<div class="method-heading">
|
|
333
|
-
<a href="#
|
|
322
|
+
<a href="#M000198" class="method-signature">
|
|
334
323
|
<span class="method-name">handle_request</span><span class="method-args">(context)</span>
|
|
335
324
|
</a>
|
|
336
325
|
</div>
|
|
@@ -340,8 +329,8 @@ invoked Can be used to setup e.g. a database connection.
|
|
|
340
329
|
called by application to send the session a request
|
|
341
330
|
</p>
|
|
342
331
|
<p><a class="source-toggle" href="#"
|
|
343
|
-
onclick="toggleCode('
|
|
344
|
-
<div class="method-source-code" id="
|
|
332
|
+
onclick="toggleCode('M000198-source');return false;">[Source]</a></p>
|
|
333
|
+
<div class="method-source-code" id="M000198-source">
|
|
345
334
|
<pre>
|
|
346
335
|
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 40</span>
|
|
347
336
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_request</span>(<span class="ruby-identifier">context</span>)
|
|
@@ -354,7 +343,7 @@ called by application to send the session a request
|
|
|
354
343
|
<span class="ruby-identifier">process_request</span>
|
|
355
344
|
<span class="ruby-identifier">sleep</span>
|
|
356
345
|
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">exn</span>
|
|
357
|
-
<span class="ruby-identifier">
|
|
346
|
+
<span class="ruby-identifier">set_response</span>(<span class="ruby-identifier">context</span>, <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">ErrorResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">exn</span>))
|
|
358
347
|
<span class="ruby-keyword kw">ensure</span>
|
|
359
348
|
<span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:wee_session</span>] = <span class="ruby-keyword kw">nil</span>
|
|
360
349
|
<span class="ruby-ivar">@context</span> = <span class="ruby-keyword kw">nil</span>
|
|
@@ -367,19 +356,19 @@ called by application to send the session a request
|
|
|
367
356
|
</div>
|
|
368
357
|
</div>
|
|
369
358
|
|
|
370
|
-
<div id="method-
|
|
371
|
-
<a name="
|
|
359
|
+
<div id="method-M000202" class="method-detail">
|
|
360
|
+
<a name="M000202"></a>
|
|
372
361
|
|
|
373
362
|
<div class="method-heading">
|
|
374
|
-
<a href="#
|
|
363
|
+
<a href="#M000202" class="method-signature">
|
|
375
364
|
<span class="method-name">process_request</span><span class="method-args">()</span>
|
|
376
365
|
</a>
|
|
377
366
|
</div>
|
|
378
367
|
|
|
379
368
|
<div class="method-description">
|
|
380
369
|
<p><a class="source-toggle" href="#"
|
|
381
|
-
onclick="toggleCode('
|
|
382
|
-
<div class="method-source-code" id="
|
|
370
|
+
onclick="toggleCode('M000202-source');return false;">[Source]</a></p>
|
|
371
|
+
<div class="method-source-code" id="M000202-source">
|
|
383
372
|
<pre>
|
|
384
373
|
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 74</span>
|
|
385
374
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_request</span>
|
|
@@ -394,7 +383,7 @@ called by application to send the session a request
|
|
|
394
383
|
|
|
395
384
|
<span class="ruby-comment cmt"># A valid page_id was specified and the corresponding page exists.</span>
|
|
396
385
|
|
|
397
|
-
<span class="ruby-ivar">@page</span>.<span class="ruby-identifier">snapshot</span>.<span class="ruby-identifier">restore</span>
|
|
386
|
+
<span class="ruby-ivar">@page</span>.<span class="ruby-identifier">snapshot</span>.<span class="ruby-identifier">restore</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">page_id</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@snapshot_page_id</span>
|
|
398
387
|
|
|
399
388
|
<span class="ruby-identifier">p</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">fields</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
|
|
400
389
|
|
|
@@ -435,7 +424,8 @@ called by application to send the session a request
|
|
|
435
424
|
<span class="ruby-comment cmt"># replace existing page with new snapshot</span>
|
|
436
425
|
<span class="ruby-ivar">@page</span>.<span class="ruby-identifier">snapshot</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">snapshot</span>
|
|
437
426
|
<span class="ruby-ivar">@page_store</span>[<span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">page_id</span>] = <span class="ruby-ivar">@page</span>
|
|
438
|
-
<span class="ruby-ivar">@context</span>.<span class="ruby-identifier">
|
|
427
|
+
<span class="ruby-ivar">@snapshot_page_id</span> = <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">page_id</span>
|
|
428
|
+
<span class="ruby-identifier">set_response</span>(<span class="ruby-ivar">@context</span>, <span class="ruby-identifier">live_update_response</span>)
|
|
439
429
|
<span class="ruby-keyword kw">else</span>
|
|
440
430
|
<span class="ruby-identifier">handle_new_page_view</span>(<span class="ruby-ivar">@context</span>)
|
|
441
431
|
<span class="ruby-keyword kw">end</span>
|
|
@@ -460,23 +450,23 @@ called by application to send the session a request
|
|
|
460
450
|
</div>
|
|
461
451
|
</div>
|
|
462
452
|
|
|
463
|
-
<div id="method-
|
|
464
|
-
<a name="
|
|
453
|
+
<div id="method-M000201" class="method-detail">
|
|
454
|
+
<a name="M000201"></a>
|
|
465
455
|
|
|
466
456
|
<div class="method-heading">
|
|
467
|
-
<a href="#
|
|
457
|
+
<a href="#M000201" class="method-signature">
|
|
468
458
|
<span class="method-name">sleep</span><span class="method-args">()</span>
|
|
469
459
|
</a>
|
|
470
460
|
</div>
|
|
471
461
|
|
|
472
462
|
<div class="method-description">
|
|
473
463
|
<p>
|
|
474
|
-
Is called after <a href="Session.html#
|
|
464
|
+
Is called after <a href="Session.html#M000202">process_request</a> is run
|
|
475
465
|
Can be used to release e.g. a database connection.
|
|
476
466
|
</p>
|
|
477
467
|
<p><a class="source-toggle" href="#"
|
|
478
|
-
onclick="toggleCode('
|
|
479
|
-
<div class="method-source-code" id="
|
|
468
|
+
onclick="toggleCode('M000201-source');return false;">[Source]</a></p>
|
|
469
|
+
<div class="method-source-code" id="M000201-source">
|
|
480
470
|
<pre>
|
|
481
471
|
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 71</span>
|
|
482
472
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sleep</span>
|
|
@@ -486,19 +476,19 @@ Can be used to release e.g. a database connection.
|
|
|
486
476
|
</div>
|
|
487
477
|
</div>
|
|
488
478
|
|
|
489
|
-
<div id="method-
|
|
490
|
-
<a name="
|
|
479
|
+
<div id="method-M000197" class="method-detail">
|
|
480
|
+
<a name="M000197"></a>
|
|
491
481
|
|
|
492
482
|
<div class="method-heading">
|
|
493
|
-
<a href="#
|
|
483
|
+
<a href="#M000197" class="method-signature">
|
|
494
484
|
<span class="method-name">snapshot</span><span class="method-args">()</span>
|
|
495
485
|
</a>
|
|
496
486
|
</div>
|
|
497
487
|
|
|
498
488
|
<div class="method-description">
|
|
499
489
|
<p><a class="source-toggle" href="#"
|
|
500
|
-
onclick="toggleCode('
|
|
501
|
-
<div class="method-source-code" id="
|
|
490
|
+
onclick="toggleCode('M000197-source');return false;">[Source]</a></p>
|
|
491
|
+
<div class="method-source-code" id="M000197-source">
|
|
502
492
|
<pre>
|
|
503
493
|
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 33</span>
|
|
504
494
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">snapshot</span>
|
|
@@ -527,21 +517,11 @@ Can be used to release e.g. a database connection.
|
|
|
527
517
|
|
|
528
518
|
<div class="name-list">
|
|
529
519
|
<table>
|
|
530
|
-
<tr class="top-aligned-row context-row">
|
|
531
|
-
<td class="context-item-name">page_store</td>
|
|
532
|
-
<td class="context-item-value"> [RW] </td>
|
|
533
|
-
<td class="context-item-desc"></td>
|
|
534
|
-
</tr>
|
|
535
520
|
<tr class="top-aligned-row context-row">
|
|
536
521
|
<td class="context-item-name">properties</td>
|
|
537
522
|
<td class="context-item-value"> [RW] </td>
|
|
538
523
|
<td class="context-item-desc"></td>
|
|
539
524
|
</tr>
|
|
540
|
-
<tr class="top-aligned-row context-row">
|
|
541
|
-
<td class="context-item-name">root_component</td>
|
|
542
|
-
<td class="context-item-value"> [RW] </td>
|
|
543
|
-
<td class="context-item-desc"></td>
|
|
544
|
-
</tr>
|
|
545
525
|
</table>
|
|
546
526
|
</div>
|
|
547
527
|
</div>
|
|
@@ -552,46 +532,21 @@ Can be used to release e.g. a database connection.
|
|
|
552
532
|
<div id="methods">
|
|
553
533
|
<h3 class="section-bar">Public Class methods</h3>
|
|
554
534
|
|
|
555
|
-
<div id="method-
|
|
556
|
-
<a name="
|
|
535
|
+
<div id="method-M000209" class="method-detail">
|
|
536
|
+
<a name="M000209"></a>
|
|
557
537
|
|
|
558
538
|
<div class="method-heading">
|
|
559
|
-
<a href="#
|
|
560
|
-
<span class="method-name">current</span><span class="method-args">()</span>
|
|
561
|
-
</a>
|
|
562
|
-
</div>
|
|
563
|
-
|
|
564
|
-
<div class="method-description">
|
|
565
|
-
<p><a class="source-toggle" href="#"
|
|
566
|
-
onclick="toggleCode('M000161-source');return false;">[Source]</a></p>
|
|
567
|
-
<div class="method-source-code" id="M000161-source">
|
|
568
|
-
<pre>
|
|
569
|
-
<span class="ruby-comment cmt"># File lib/wee/continuation/session.rb, line 8</span>
|
|
570
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">current</span>
|
|
571
|
-
<span class="ruby-identifier">sess</span> = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:wee_session</span>]
|
|
572
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"not in session"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">sess</span>.<span class="ruby-identifier">nil?</span>
|
|
573
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sess</span>
|
|
574
|
-
<span class="ruby-keyword kw">end</span>
|
|
575
|
-
</pre>
|
|
576
|
-
</div>
|
|
577
|
-
</div>
|
|
578
|
-
</div>
|
|
579
|
-
|
|
580
|
-
<div id="method-M000162" class="method-detail">
|
|
581
|
-
<a name="M000162"></a>
|
|
582
|
-
|
|
583
|
-
<div class="method-heading">
|
|
584
|
-
<a href="#M000162" class="method-signature">
|
|
539
|
+
<a href="#M000209" class="method-signature">
|
|
585
540
|
<span class="method-name">new</span><span class="method-args">(&block)</span>
|
|
586
541
|
</a>
|
|
587
542
|
</div>
|
|
588
543
|
|
|
589
544
|
<div class="method-description">
|
|
590
545
|
<p><a class="source-toggle" href="#"
|
|
591
|
-
onclick="toggleCode('
|
|
592
|
-
<div class="method-source-code" id="
|
|
546
|
+
onclick="toggleCode('M000209-source');return false;">[Source]</a></p>
|
|
547
|
+
<div class="method-source-code" id="M000209-source">
|
|
593
548
|
<pre>
|
|
594
|
-
<span class="ruby-comment cmt"># File lib/wee/continuation/session.rb, line
|
|
549
|
+
<span class="ruby-comment cmt"># File lib/wee/continuation/session.rb, line 4</span>
|
|
595
550
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
|
596
551
|
<span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:wee_session</span>] = <span class="ruby-keyword kw">self</span>
|
|
597
552
|
|
|
@@ -617,107 +572,11 @@ Can be used to release e.g. a database connection.
|
|
|
617
572
|
|
|
618
573
|
<h3 class="section-bar">Public Instance methods</h3>
|
|
619
574
|
|
|
620
|
-
<div id="method-
|
|
621
|
-
<a name="
|
|
622
|
-
|
|
623
|
-
<div class="method-heading">
|
|
624
|
-
<a href="#M000167" class="method-signature">
|
|
625
|
-
<span class="method-name">awake</span><span class="method-args">()</span>
|
|
626
|
-
</a>
|
|
627
|
-
</div>
|
|
628
|
-
|
|
629
|
-
<div class="method-description">
|
|
630
|
-
<p>
|
|
631
|
-
Is called before <a href="Session.html#M000155">process_request</a> is
|
|
632
|
-
invoked Can be used to setup e.g. a database connection.
|
|
633
|
-
</p>
|
|
634
|
-
<p><a class="source-toggle" href="#"
|
|
635
|
-
onclick="toggleCode('M000167-source');return false;">[Source]</a></p>
|
|
636
|
-
<div class="method-source-code" id="M000167-source">
|
|
637
|
-
<pre>
|
|
638
|
-
<span class="ruby-comment cmt"># File lib/wee/continuation/session.rb, line 94</span>
|
|
639
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">awake</span>
|
|
640
|
-
<span class="ruby-keyword kw">end</span>
|
|
641
|
-
</pre>
|
|
642
|
-
</div>
|
|
643
|
-
</div>
|
|
644
|
-
</div>
|
|
645
|
-
|
|
646
|
-
<div id="method-M000166" class="method-detail">
|
|
647
|
-
<a name="M000166"></a>
|
|
648
|
-
|
|
649
|
-
<div class="method-heading">
|
|
650
|
-
<a href="#M000166" class="method-signature">
|
|
651
|
-
<span class="method-name">create_page</span><span class="method-args">(snapshot)</span>
|
|
652
|
-
</a>
|
|
653
|
-
</div>
|
|
654
|
-
|
|
655
|
-
<div class="method-description">
|
|
656
|
-
<p><a class="source-toggle" href="#"
|
|
657
|
-
onclick="toggleCode('M000166-source');return false;">[Source]</a></p>
|
|
658
|
-
<div class="method-source-code" id="M000166-source">
|
|
659
|
-
<pre>
|
|
660
|
-
<span class="ruby-comment cmt"># File lib/wee/continuation/session.rb, line 87</span>
|
|
661
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_page</span>(<span class="ruby-identifier">snapshot</span>)
|
|
662
|
-
<span class="ruby-identifier">idgen</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">SimpleIdGenerator</span>.<span class="ruby-identifier">new</span>
|
|
663
|
-
<span class="ruby-identifier">page</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">Page</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">snapshot</span>, <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">CallbackRegistry</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">idgen</span>))
|
|
664
|
-
<span class="ruby-keyword kw">end</span>
|
|
665
|
-
</pre>
|
|
666
|
-
</div>
|
|
667
|
-
</div>
|
|
668
|
-
</div>
|
|
669
|
-
|
|
670
|
-
<div id="method-M000170" class="method-detail">
|
|
671
|
-
<a name="M000170"></a>
|
|
672
|
-
|
|
673
|
-
<div class="method-heading">
|
|
674
|
-
<a href="#M000170" class="method-signature">
|
|
675
|
-
<span class="method-name">current_context</span><span class="method-args">()</span>
|
|
676
|
-
</a>
|
|
677
|
-
</div>
|
|
678
|
-
|
|
679
|
-
<div class="method-description">
|
|
680
|
-
<p><a class="source-toggle" href="#"
|
|
681
|
-
onclick="toggleCode('M000170-source');return false;">[Source]</a></p>
|
|
682
|
-
<div class="method-source-code" id="M000170-source">
|
|
683
|
-
<pre>
|
|
684
|
-
<span class="ruby-comment cmt"># File lib/wee/continuation/session.rb, line 176</span>
|
|
685
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">current_context</span>
|
|
686
|
-
<span class="ruby-ivar">@context</span>
|
|
687
|
-
<span class="ruby-keyword kw">end</span>
|
|
688
|
-
</pre>
|
|
689
|
-
</div>
|
|
690
|
-
</div>
|
|
691
|
-
</div>
|
|
692
|
-
|
|
693
|
-
<div id="method-M000171" class="method-detail">
|
|
694
|
-
<a name="M000171"></a>
|
|
575
|
+
<div id="method-M000205" class="method-detail">
|
|
576
|
+
<a name="M000205"></a>
|
|
695
577
|
|
|
696
578
|
<div class="method-heading">
|
|
697
|
-
<a href="#
|
|
698
|
-
<span class="method-name">current_page</span><span class="method-args">()</span>
|
|
699
|
-
</a>
|
|
700
|
-
</div>
|
|
701
|
-
|
|
702
|
-
<div class="method-description">
|
|
703
|
-
<p><a class="source-toggle" href="#"
|
|
704
|
-
onclick="toggleCode('M000171-source');return false;">[Source]</a></p>
|
|
705
|
-
<div class="method-source-code" id="M000171-source">
|
|
706
|
-
<pre>
|
|
707
|
-
<span class="ruby-comment cmt"># File lib/wee/continuation/session.rb, line 180</span>
|
|
708
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">current_page</span>
|
|
709
|
-
<span class="ruby-ivar">@page</span>
|
|
710
|
-
<span class="ruby-keyword kw">end</span>
|
|
711
|
-
</pre>
|
|
712
|
-
</div>
|
|
713
|
-
</div>
|
|
714
|
-
</div>
|
|
715
|
-
|
|
716
|
-
<div id="method-M000158" class="method-detail">
|
|
717
|
-
<a name="M000158"></a>
|
|
718
|
-
|
|
719
|
-
<div class="method-heading">
|
|
720
|
-
<a href="#M000158" class="method-signature">
|
|
579
|
+
<a href="#M000205" class="method-signature">
|
|
721
580
|
<span class="method-name">get_property</span><span class="method-args">(prop, klass)</span>
|
|
722
581
|
</a>
|
|
723
582
|
</div>
|
|
@@ -727,10 +586,10 @@ invoked Can be used to setup e.g. a database connection.
|
|
|
727
586
|
Returns an "owned" property for the given <tt>klass</tt>.
|
|
728
587
|
</p>
|
|
729
588
|
<p><a class="source-toggle" href="#"
|
|
730
|
-
onclick="toggleCode('
|
|
731
|
-
<div class="method-source-code" id="
|
|
589
|
+
onclick="toggleCode('M000205-source');return false;">[Source]</a></p>
|
|
590
|
+
<div class="method-source-code" id="M000205-source">
|
|
732
591
|
<pre>
|
|
733
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
|
592
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 165</span>
|
|
734
593
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_property</span>(<span class="ruby-identifier">prop</span>, <span class="ruby-identifier">klass</span>)
|
|
735
594
|
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@properties</span>
|
|
736
595
|
<span class="ruby-ivar">@properties</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">klass</span>, {})[<span class="ruby-identifier">prop</span>]
|
|
@@ -743,11 +602,11 @@ Returns an "owned" property for the given <tt>klass</tt>.
|
|
|
743
602
|
</div>
|
|
744
603
|
</div>
|
|
745
604
|
|
|
746
|
-
<div id="method-
|
|
747
|
-
<a name="
|
|
605
|
+
<div id="method-M000210" class="method-detail">
|
|
606
|
+
<a name="M000210"></a>
|
|
748
607
|
|
|
749
608
|
<div class="method-heading">
|
|
750
|
-
<a href="#
|
|
609
|
+
<a href="#M000210" class="method-signature">
|
|
751
610
|
<span class="method-name">handle_request</span><span class="method-args">(context)</span>
|
|
752
611
|
</a>
|
|
753
612
|
</div>
|
|
@@ -757,10 +616,10 @@ Returns an "owned" property for the given <tt>klass</tt>.
|
|
|
757
616
|
called by application to send the session a request
|
|
758
617
|
</p>
|
|
759
618
|
<p><a class="source-toggle" href="#"
|
|
760
|
-
onclick="toggleCode('
|
|
761
|
-
<div class="method-source-code" id="
|
|
619
|
+
onclick="toggleCode('M000210-source');return false;">[Source]</a></p>
|
|
620
|
+
<div class="method-source-code" id="M000210-source">
|
|
762
621
|
<pre>
|
|
763
|
-
<span class="ruby-comment cmt"># File lib/wee/continuation/session.rb, line
|
|
622
|
+
<span class="ruby-comment cmt"># File lib/wee/continuation/session.rb, line 24</span>
|
|
764
623
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_request</span>(<span class="ruby-identifier">context</span>)
|
|
765
624
|
<span class="ruby-keyword kw">super</span>
|
|
766
625
|
|
|
@@ -776,164 +635,21 @@ called by application to send the session a request
|
|
|
776
635
|
</div>
|
|
777
636
|
</div>
|
|
778
637
|
|
|
779
|
-
<div id="method-
|
|
780
|
-
<a name="
|
|
638
|
+
<div id="method-M000211" class="method-detail">
|
|
639
|
+
<a name="M000211"></a>
|
|
781
640
|
|
|
782
641
|
<div class="method-heading">
|
|
783
|
-
<a href="#
|
|
784
|
-
<span class="method-name">process_request</span><span class="method-args">()</span>
|
|
785
|
-
</a>
|
|
786
|
-
</div>
|
|
787
|
-
|
|
788
|
-
<div class="method-description">
|
|
789
|
-
<p><a class="source-toggle" href="#"
|
|
790
|
-
onclick="toggleCode('M000169-source');return false;">[Source]</a></p>
|
|
791
|
-
<div class="method-source-code" id="M000169-source">
|
|
792
|
-
<pre>
|
|
793
|
-
<span class="ruby-comment cmt"># File lib/wee/continuation/session.rb, line 102</span>
|
|
794
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_request</span>
|
|
795
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">page_id</span>.<span class="ruby-identifier">nil?</span>
|
|
796
|
-
|
|
797
|
-
<span class="ruby-comment cmt"># No page_id was specified in the URL. This means that we start with a</span>
|
|
798
|
-
<span class="ruby-comment cmt"># fresh component and a fresh page_id, then redirect to render itself.</span>
|
|
799
|
-
|
|
800
|
-
<span class="ruby-identifier">handle_new_page_view</span>(<span class="ruby-ivar">@context</span>, <span class="ruby-ivar">@initial_snapshot</span>)
|
|
801
|
-
|
|
802
|
-
<span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@page</span> = <span class="ruby-ivar">@page_store</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">page_id</span>, <span class="ruby-keyword kw">false</span>)
|
|
803
|
-
|
|
804
|
-
<span class="ruby-comment cmt"># A valid page_id was specified and the corresponding page exists.</span>
|
|
805
|
-
|
|
806
|
-
<span class="ruby-ivar">@page</span>.<span class="ruby-identifier">snapshot</span>.<span class="ruby-identifier">restore</span>
|
|
807
|
-
|
|
808
|
-
<span class="ruby-identifier">p</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">fields</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
|
|
809
|
-
|
|
810
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">fields</span>.<span class="ruby-identifier">empty?</span>
|
|
811
|
-
|
|
812
|
-
<span class="ruby-comment cmt"># No action/inputs were specified -> render page</span>
|
|
813
|
-
<span class="ruby-comment cmt">#</span>
|
|
814
|
-
<span class="ruby-comment cmt"># 1. Reset the action/input fields (as they are regenerated in the</span>
|
|
815
|
-
<span class="ruby-comment cmt"># rendering process).</span>
|
|
816
|
-
<span class="ruby-comment cmt"># 2. Render the page (respond).</span>
|
|
817
|
-
<span class="ruby-comment cmt"># 3. Store the page back into the store</span>
|
|
818
|
-
|
|
819
|
-
<span class="ruby-ivar">@page</span> = <span class="ruby-identifier">create_page</span>(<span class="ruby-ivar">@page</span>.<span class="ruby-identifier">snapshot</span>) <span class="ruby-comment cmt"># remove all action/input handlers</span>
|
|
820
|
-
<span class="ruby-identifier">respond</span>(<span class="ruby-ivar">@context</span>, <span class="ruby-ivar">@page</span>.<span class="ruby-identifier">callbacks</span>) <span class="ruby-comment cmt"># render</span>
|
|
821
|
-
<span class="ruby-ivar">@page_store</span>[<span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">page_id</span>] = <span class="ruby-ivar">@page</span> <span class="ruby-comment cmt"># store</span>
|
|
822
|
-
|
|
823
|
-
<span class="ruby-keyword kw">else</span>
|
|
824
|
-
|
|
825
|
-
<span class="ruby-comment cmt"># Actions/inputs were specified.</span>
|
|
826
|
-
<span class="ruby-comment cmt">#</span>
|
|
827
|
-
<span class="ruby-comment cmt"># We process the request and invoke actions/inputs. Then we generate a</span>
|
|
828
|
-
<span class="ruby-comment cmt"># new page view. </span>
|
|
829
|
-
|
|
830
|
-
<span class="ruby-identifier">callback_stream</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">CallbackStream</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@page</span>.<span class="ruby-identifier">callbacks</span>, <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">fields</span>)
|
|
831
|
-
|
|
832
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">callback_stream</span>.<span class="ruby-identifier">all_of_type</span>(<span class="ruby-identifier">:action</span>).<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>
|
|
833
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"Not allowed to specify more than one action callback"</span>
|
|
834
|
-
<span class="ruby-keyword kw">end</span>
|
|
835
|
-
|
|
836
|
-
<span class="ruby-identifier">live_update_response</span> = <span class="ruby-identifier">catch</span>(<span class="ruby-identifier">:wee_live_update</span>) {
|
|
837
|
-
<span class="ruby-identifier">catch</span>(<span class="ruby-identifier">:wee_back_to_session</span>) {
|
|
838
|
-
<span class="ruby-ivar">@root_component</span>.<span class="ruby-identifier">process_callbacks_chain</span>(<span class="ruby-identifier">callback_stream</span>)
|
|
839
|
-
}
|
|
840
|
-
<span class="ruby-keyword kw">nil</span>
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">live_update_response</span>
|
|
844
|
-
<span class="ruby-comment cmt"># replace existing page with new snapshot</span>
|
|
845
|
-
<span class="ruby-ivar">@page</span>.<span class="ruby-identifier">snapshot</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">snapshot</span>
|
|
846
|
-
<span class="ruby-ivar">@page_store</span>[<span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">page_id</span>] = <span class="ruby-ivar">@page</span>
|
|
847
|
-
<span class="ruby-ivar">@context</span>.<span class="ruby-identifier">response</span> = <span class="ruby-identifier">live_update_response</span>
|
|
848
|
-
<span class="ruby-keyword kw">else</span>
|
|
849
|
-
<span class="ruby-identifier">handle_new_page_view</span>(<span class="ruby-ivar">@context</span>)
|
|
850
|
-
<span class="ruby-keyword kw">end</span>
|
|
851
|
-
|
|
852
|
-
<span class="ruby-keyword kw">end</span>
|
|
853
|
-
|
|
854
|
-
<span class="ruby-keyword kw">else</span>
|
|
855
|
-
|
|
856
|
-
<span class="ruby-comment cmt"># A page_id was specified in the URL, but there's no page for it in the</span>
|
|
857
|
-
<span class="ruby-comment cmt"># page store. Either the page has timed out, or an invalid page_id was</span>
|
|
858
|
-
<span class="ruby-comment cmt"># specified. </span>
|
|
859
|
-
<span class="ruby-comment cmt">#</span>
|
|
860
|
-
<span class="ruby-comment cmt"># TODO:: Display an "invalid page or page timed out" message, which</span>
|
|
861
|
-
<span class="ruby-comment cmt"># forwards to /app/session-id</span>
|
|
862
|
-
|
|
863
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"Not yet implemented"</span>
|
|
864
|
-
|
|
865
|
-
<span class="ruby-keyword kw">end</span>
|
|
866
|
-
<span class="ruby-keyword kw">end</span>
|
|
867
|
-
</pre>
|
|
868
|
-
</div>
|
|
869
|
-
</div>
|
|
870
|
-
</div>
|
|
871
|
-
|
|
872
|
-
<div id="method-M000168" class="method-detail">
|
|
873
|
-
<a name="M000168"></a>
|
|
874
|
-
|
|
875
|
-
<div class="method-heading">
|
|
876
|
-
<a href="#M000168" class="method-signature">
|
|
877
|
-
<span class="method-name">sleep</span><span class="method-args">()</span>
|
|
878
|
-
</a>
|
|
879
|
-
</div>
|
|
880
|
-
|
|
881
|
-
<div class="method-description">
|
|
882
|
-
<p>
|
|
883
|
-
Is called after <a href="Session.html#M000155">process_request</a> is run
|
|
884
|
-
Can be used to release e.g. a database connection.
|
|
885
|
-
</p>
|
|
886
|
-
<p><a class="source-toggle" href="#"
|
|
887
|
-
onclick="toggleCode('M000168-source');return false;">[Source]</a></p>
|
|
888
|
-
<div class="method-source-code" id="M000168-source">
|
|
889
|
-
<pre>
|
|
890
|
-
<span class="ruby-comment cmt"># File lib/wee/continuation/session.rb, line 99</span>
|
|
891
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sleep</span>
|
|
892
|
-
<span class="ruby-keyword kw">end</span>
|
|
893
|
-
</pre>
|
|
894
|
-
</div>
|
|
895
|
-
</div>
|
|
896
|
-
</div>
|
|
897
|
-
|
|
898
|
-
<div id="method-M000163" class="method-detail">
|
|
899
|
-
<a name="M000163"></a>
|
|
900
|
-
|
|
901
|
-
<div class="method-heading">
|
|
902
|
-
<a href="#M000163" class="method-signature">
|
|
903
|
-
<span class="method-name">snapshot</span><span class="method-args">()</span>
|
|
904
|
-
</a>
|
|
905
|
-
</div>
|
|
906
|
-
|
|
907
|
-
<div class="method-description">
|
|
908
|
-
<p><a class="source-toggle" href="#"
|
|
909
|
-
onclick="toggleCode('M000163-source');return false;">[Source]</a></p>
|
|
910
|
-
<div class="method-source-code" id="M000163-source">
|
|
911
|
-
<pre>
|
|
912
|
-
<span class="ruby-comment cmt"># File lib/wee/continuation/session.rb, line 33</span>
|
|
913
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">snapshot</span>
|
|
914
|
-
<span class="ruby-ivar">@root_component</span>.<span class="ruby-identifier">backtrack_state_chain</span>(<span class="ruby-identifier">snap</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">Snapshot</span>.<span class="ruby-identifier">new</span>)
|
|
915
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">snap</span>.<span class="ruby-identifier">freeze</span>
|
|
916
|
-
<span class="ruby-keyword kw">end</span>
|
|
917
|
-
</pre>
|
|
918
|
-
</div>
|
|
919
|
-
</div>
|
|
920
|
-
</div>
|
|
921
|
-
|
|
922
|
-
<div id="method-M000165" class="method-detail">
|
|
923
|
-
<a name="M000165"></a>
|
|
924
|
-
|
|
925
|
-
<div class="method-heading">
|
|
926
|
-
<a href="#M000165" class="method-signature">
|
|
642
|
+
<a href="#M000211" class="method-signature">
|
|
927
643
|
<span class="method-name">start_request_response_loop</span><span class="method-args">()</span>
|
|
928
644
|
</a>
|
|
929
645
|
</div>
|
|
930
646
|
|
|
931
647
|
<div class="method-description">
|
|
932
648
|
<p><a class="source-toggle" href="#"
|
|
933
|
-
onclick="toggleCode('
|
|
934
|
-
<div class="method-source-code" id="
|
|
649
|
+
onclick="toggleCode('M000211-source');return false;">[Source]</a></p>
|
|
650
|
+
<div class="method-source-code" id="M000211-source">
|
|
935
651
|
<pre>
|
|
936
|
-
<span class="ruby-comment cmt"># File lib/wee/continuation/session.rb, line
|
|
652
|
+
<span class="ruby-comment cmt"># File lib/wee/continuation/session.rb, line 35</span>
|
|
937
653
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start_request_response_loop</span>
|
|
938
654
|
<span class="ruby-constant">Thread</span>.<span class="ruby-identifier">abort_on_exception</span> = <span class="ruby-keyword kw">true</span>
|
|
939
655
|
<span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> {
|
|
@@ -977,50 +693,51 @@ Can be used to release e.g. a database connection.
|
|
|
977
693
|
|
|
978
694
|
<h3 class="section-bar">Private Instance methods</h3>
|
|
979
695
|
|
|
980
|
-
<div id="method-
|
|
981
|
-
<a name="
|
|
696
|
+
<div id="method-M000206" class="method-detail">
|
|
697
|
+
<a name="M000206"></a>
|
|
982
698
|
|
|
983
699
|
<div class="method-heading">
|
|
984
|
-
<a href="#
|
|
700
|
+
<a href="#M000206" class="method-signature">
|
|
985
701
|
<span class="method-name">handle_new_page_view</span><span class="method-args">(context, snapshot=nil)</span>
|
|
986
702
|
</a>
|
|
987
703
|
</div>
|
|
988
704
|
|
|
989
705
|
<div class="method-description">
|
|
990
706
|
<p><a class="source-toggle" href="#"
|
|
991
|
-
onclick="toggleCode('
|
|
992
|
-
<div class="method-source-code" id="
|
|
707
|
+
onclick="toggleCode('M000206-source');return false;">[Source]</a></p>
|
|
708
|
+
<div class="method-source-code" id="M000206-source">
|
|
993
709
|
<pre>
|
|
994
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
|
710
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 175</span>
|
|
995
711
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_new_page_view</span>(<span class="ruby-identifier">context</span>, <span class="ruby-identifier">snapshot</span>=<span class="ruby-keyword kw">nil</span>)
|
|
996
712
|
<span class="ruby-identifier">new_page_id</span> = <span class="ruby-ivar">@idgen</span>.<span class="ruby-identifier">next</span>.<span class="ruby-identifier">to_s</span>
|
|
997
713
|
<span class="ruby-identifier">new_page</span> = <span class="ruby-identifier">create_page</span>(<span class="ruby-identifier">snapshot</span> <span class="ruby-operator">||</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">snapshot</span>())
|
|
998
714
|
<span class="ruby-ivar">@page_store</span>[<span class="ruby-identifier">new_page_id</span>] = <span class="ruby-identifier">new_page</span>
|
|
715
|
+
<span class="ruby-ivar">@snapshot_page_id</span> = <span class="ruby-identifier">new_page_id</span>
|
|
999
716
|
<span class="ruby-identifier">redirect_url</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">build_url</span>(<span class="ruby-identifier">context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">request_handler_id</span>, <span class="ruby-identifier">new_page_id</span>)
|
|
1000
|
-
<span class="ruby-identifier">
|
|
717
|
+
<span class="ruby-identifier">set_response</span>(<span class="ruby-identifier">context</span>, <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">RedirectResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">redirect_url</span>))
|
|
1001
718
|
<span class="ruby-keyword kw">end</span>
|
|
1002
719
|
</pre>
|
|
1003
720
|
</div>
|
|
1004
721
|
</div>
|
|
1005
722
|
</div>
|
|
1006
723
|
|
|
1007
|
-
<div id="method-
|
|
1008
|
-
<a name="
|
|
724
|
+
<div id="method-M000208" class="method-detail">
|
|
725
|
+
<a name="M000208"></a>
|
|
1009
726
|
|
|
1010
727
|
<div class="method-heading">
|
|
1011
|
-
<a href="#
|
|
728
|
+
<a href="#M000208" class="method-signature">
|
|
1012
729
|
<span class="method-name">respond</span><span class="method-args">(context, callbacks)</span>
|
|
1013
730
|
</a>
|
|
1014
731
|
</div>
|
|
1015
732
|
|
|
1016
733
|
<div class="method-description">
|
|
1017
734
|
<p><a class="source-toggle" href="#"
|
|
1018
|
-
onclick="toggleCode('
|
|
1019
|
-
<div class="method-source-code" id="
|
|
735
|
+
onclick="toggleCode('M000208-source');return false;">[Source]</a></p>
|
|
736
|
+
<div class="method-source-code" id="M000208-source">
|
|
1020
737
|
<pre>
|
|
1021
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
|
738
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 188</span>
|
|
1022
739
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">respond</span>(<span class="ruby-identifier">context</span>, <span class="ruby-identifier">callbacks</span>)
|
|
1023
|
-
<span class="ruby-identifier">
|
|
740
|
+
<span class="ruby-identifier">set_response</span>(<span class="ruby-identifier">context</span>, <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">GenericResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'text/html'</span>, <span class="ruby-value str">''</span>))
|
|
1024
741
|
|
|
1025
742
|
<span class="ruby-identifier">rctx</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">RenderingContext</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">context</span>.<span class="ruby-identifier">request</span>, <span class="ruby-identifier">context</span>.<span class="ruby-identifier">response</span>, <span class="ruby-identifier">callbacks</span>, <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">HtmlWriter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">context</span>.<span class="ruby-identifier">response</span>.<span class="ruby-identifier">content</span>))
|
|
1026
743
|
<span class="ruby-ivar">@root_component</span>.<span class="ruby-identifier">do_render_chain</span>(<span class="ruby-identifier">rctx</span>)
|
|
@@ -1030,117 +747,23 @@ Can be used to release e.g. a database connection.
|
|
|
1030
747
|
</div>
|
|
1031
748
|
</div>
|
|
1032
749
|
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
<div id="section">
|
|
1036
|
-
<h2 class="section-title"><a name="SEC00118">Properties</a></h2>
|
|
1037
|
-
<div class="section-comment">
|
|
1038
|
-
|
|
1039
|
-
</div>
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
<div id="attribute-list">
|
|
1046
|
-
<h3 class="section-bar">Attributes</h3>
|
|
1047
|
-
|
|
1048
|
-
<div class="name-list">
|
|
1049
|
-
<table>
|
|
1050
|
-
<tr class="top-aligned-row context-row">
|
|
1051
|
-
<td class="context-item-name">properties</td>
|
|
1052
|
-
<td class="context-item-value"> [RW] </td>
|
|
1053
|
-
<td class="context-item-desc"></td>
|
|
1054
|
-
</tr>
|
|
1055
|
-
</table>
|
|
1056
|
-
</div>
|
|
1057
|
-
</div>
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
<!-- if method_list -->
|
|
1062
|
-
<div id="methods">
|
|
1063
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
|
1064
|
-
|
|
1065
|
-
<div id="method-M000172" class="method-detail">
|
|
1066
|
-
<a name="M000172"></a>
|
|
1067
|
-
|
|
1068
|
-
<div class="method-heading">
|
|
1069
|
-
<a href="#M000172" class="method-signature">
|
|
1070
|
-
<span class="method-name">get_property</span><span class="method-args">(prop, klass)</span>
|
|
1071
|
-
</a>
|
|
1072
|
-
</div>
|
|
1073
|
-
|
|
1074
|
-
<div class="method-description">
|
|
1075
|
-
<p>
|
|
1076
|
-
Returns an "owned" property for the given <tt>klass</tt>.
|
|
1077
|
-
</p>
|
|
1078
|
-
<p><a class="source-toggle" href="#"
|
|
1079
|
-
onclick="toggleCode('M000172-source');return false;">[Source]</a></p>
|
|
1080
|
-
<div class="method-source-code" id="M000172-source">
|
|
1081
|
-
<pre>
|
|
1082
|
-
<span class="ruby-comment cmt"># File lib/wee/continuation/session.rb, line 192</span>
|
|
1083
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_property</span>(<span class="ruby-identifier">prop</span>, <span class="ruby-identifier">klass</span>)
|
|
1084
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@properties</span>
|
|
1085
|
-
<span class="ruby-ivar">@properties</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">klass</span>, {})[<span class="ruby-identifier">prop</span>]
|
|
1086
|
-
<span class="ruby-keyword kw">else</span>
|
|
1087
|
-
<span class="ruby-keyword kw">nil</span>
|
|
1088
|
-
<span class="ruby-keyword kw">end</span>
|
|
1089
|
-
<span class="ruby-keyword kw">end</span>
|
|
1090
|
-
</pre>
|
|
1091
|
-
</div>
|
|
1092
|
-
</div>
|
|
1093
|
-
</div>
|
|
1094
|
-
|
|
1095
|
-
<h3 class="section-bar">Private Instance methods</h3>
|
|
1096
|
-
|
|
1097
|
-
<div id="method-M000173" class="method-detail">
|
|
1098
|
-
<a name="M000173"></a>
|
|
1099
|
-
|
|
1100
|
-
<div class="method-heading">
|
|
1101
|
-
<a href="#M000173" class="method-signature">
|
|
1102
|
-
<span class="method-name">handle_new_page_view</span><span class="method-args">(context, snapshot=nil)</span>
|
|
1103
|
-
</a>
|
|
1104
|
-
</div>
|
|
1105
|
-
|
|
1106
|
-
<div class="method-description">
|
|
1107
|
-
<p><a class="source-toggle" href="#"
|
|
1108
|
-
onclick="toggleCode('M000173-source');return false;">[Source]</a></p>
|
|
1109
|
-
<div class="method-source-code" id="M000173-source">
|
|
1110
|
-
<pre>
|
|
1111
|
-
<span class="ruby-comment cmt"># File lib/wee/continuation/session.rb, line 202</span>
|
|
1112
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_new_page_view</span>(<span class="ruby-identifier">context</span>, <span class="ruby-identifier">snapshot</span>=<span class="ruby-keyword kw">nil</span>)
|
|
1113
|
-
<span class="ruby-identifier">new_page_id</span> = <span class="ruby-ivar">@idgen</span>.<span class="ruby-identifier">next</span>.<span class="ruby-identifier">to_s</span>
|
|
1114
|
-
<span class="ruby-identifier">new_page</span> = <span class="ruby-identifier">create_page</span>(<span class="ruby-identifier">snapshot</span> <span class="ruby-operator">||</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">snapshot</span>())
|
|
1115
|
-
<span class="ruby-ivar">@page_store</span>[<span class="ruby-identifier">new_page_id</span>] = <span class="ruby-identifier">new_page</span>
|
|
1116
|
-
<span class="ruby-identifier">redirect_url</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">build_url</span>(<span class="ruby-identifier">context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">request_handler_id</span>, <span class="ruby-identifier">new_page_id</span>)
|
|
1117
|
-
<span class="ruby-identifier">context</span>.<span class="ruby-identifier">response</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">RedirectResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">redirect_url</span>)
|
|
1118
|
-
<span class="ruby-keyword kw">end</span>
|
|
1119
|
-
</pre>
|
|
1120
|
-
</div>
|
|
1121
|
-
</div>
|
|
1122
|
-
</div>
|
|
1123
|
-
|
|
1124
|
-
<div id="method-M000174" class="method-detail">
|
|
1125
|
-
<a name="M000174"></a>
|
|
750
|
+
<div id="method-M000207" class="method-detail">
|
|
751
|
+
<a name="M000207"></a>
|
|
1126
752
|
|
|
1127
753
|
<div class="method-heading">
|
|
1128
|
-
<a href="#
|
|
1129
|
-
<span class="method-name">
|
|
754
|
+
<a href="#M000207" class="method-signature">
|
|
755
|
+
<span class="method-name">set_response</span><span class="method-args">(context, response)</span>
|
|
1130
756
|
</a>
|
|
1131
757
|
</div>
|
|
1132
758
|
|
|
1133
759
|
<div class="method-description">
|
|
1134
760
|
<p><a class="source-toggle" href="#"
|
|
1135
|
-
onclick="toggleCode('
|
|
1136
|
-
<div class="method-source-code" id="
|
|
761
|
+
onclick="toggleCode('M000207-source');return false;">[Source]</a></p>
|
|
762
|
+
<div class="method-source-code" id="M000207-source">
|
|
1137
763
|
<pre>
|
|
1138
|
-
<span class="ruby-comment cmt"># File lib/wee/
|
|
1139
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
|
1140
|
-
<span class="ruby-identifier">context</span>.<span class="ruby-identifier">response</span> = <span class="ruby-
|
|
1141
|
-
|
|
1142
|
-
<span class="ruby-identifier">rctx</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">RenderingContext</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">context</span>.<span class="ruby-identifier">request</span>, <span class="ruby-identifier">context</span>.<span class="ruby-identifier">response</span>, <span class="ruby-identifier">callbacks</span>, <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">HtmlWriter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">context</span>.<span class="ruby-identifier">response</span>.<span class="ruby-identifier">content</span>))
|
|
1143
|
-
<span class="ruby-ivar">@root_component</span>.<span class="ruby-identifier">do_render_chain</span>(<span class="ruby-identifier">rctx</span>)
|
|
764
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 184</span>
|
|
765
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_response</span>(<span class="ruby-identifier">context</span>, <span class="ruby-identifier">response</span>)
|
|
766
|
+
<span class="ruby-identifier">context</span>.<span class="ruby-identifier">response</span> = <span class="ruby-identifier">response</span>
|
|
1144
767
|
<span class="ruby-keyword kw">end</span>
|
|
1145
768
|
</pre>
|
|
1146
769
|
</div>
|