wee 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +0 -1
- data/Rakefile +5 -0
- data/TODO +6 -0
- data/doc/rdoc/classes/Enumerable.html +6 -6
- data/doc/rdoc/classes/Wee/AnswerDecoration.html +10 -10
- data/doc/rdoc/classes/Wee/Application.html +110 -52
- data/doc/rdoc/classes/Wee/Brush/ActionCallbackMixin.html +8 -15
- data/doc/rdoc/classes/Wee/Brush/ActionURLCallbackMixin.html +8 -19
- data/doc/rdoc/classes/Wee/Brush/AnchorTag.html +22 -22
- data/doc/rdoc/classes/Wee/Brush/FileUploadTag.html +156 -0
- data/doc/rdoc/classes/Wee/Brush/FormTag.html +50 -25
- data/doc/rdoc/classes/Wee/Brush/GenericEncodedTextBrush.html +12 -12
- data/doc/rdoc/classes/Wee/Brush/GenericTagBrush.html +36 -36
- data/doc/rdoc/classes/Wee/Brush/GenericTextBrush.html +12 -12
- data/doc/rdoc/classes/Wee/Brush/ImageButtonTag.html +16 -16
- data/doc/rdoc/classes/Wee/Brush/InputCallbackMixin.html +8 -15
- data/doc/rdoc/classes/Wee/Brush/InputTag.html +12 -12
- data/doc/rdoc/classes/Wee/Brush/Page.html +14 -14
- data/doc/rdoc/classes/Wee/Brush/SelectListTag.html +28 -28
- data/doc/rdoc/classes/Wee/Brush/SelectOptionTag.html +14 -14
- 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 +36 -36
- data/doc/rdoc/classes/Wee/Brush/TableTag.html +6 -6
- data/doc/rdoc/classes/Wee/Brush/TextAreaTag.html +28 -28
- data/doc/rdoc/classes/Wee/Brush/TextInputTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush.html +19 -19
- data/doc/rdoc/classes/Wee/CallbackRegistry.html +33 -33
- data/doc/rdoc/classes/Wee/CallbackStream.html +18 -18
- data/doc/rdoc/classes/Wee/Canvas.html +24 -24
- data/doc/rdoc/classes/Wee/Component.html +163 -138
- data/doc/rdoc/classes/Wee/Decoration.html +72 -41
- data/doc/rdoc/classes/Wee/Delegate.html +31 -31
- data/doc/rdoc/classes/Wee/ErrorResponse.html +12 -12
- data/doc/rdoc/classes/Wee/GenericResponse.html +6 -6
- data/doc/rdoc/classes/Wee/Helper.html +148 -0
- data/doc/rdoc/classes/Wee/HtmlCanvas.html +267 -166
- data/doc/rdoc/classes/Wee/HtmlWriter.html +40 -40
- data/doc/rdoc/classes/Wee/LiteralMethodCallback.html +12 -12
- data/doc/rdoc/classes/Wee/PageDecoration.html +199 -0
- data/doc/rdoc/classes/Wee/Presenter.html +69 -69
- data/doc/rdoc/classes/Wee/RedirectResponse.html +6 -6
- data/doc/rdoc/classes/Wee/RefreshResponse.html +6 -6
- data/doc/rdoc/classes/Wee/Request.html +18 -18
- data/doc/rdoc/classes/Wee/RequestHandler.html +32 -31
- data/doc/rdoc/classes/Wee/Response.html +24 -24
- data/doc/rdoc/classes/Wee/Session.html +83 -64
- data/doc/rdoc/classes/Wee/SimpleIdGenerator.html +18 -18
- data/doc/rdoc/classes/Wee/Snapshot.html +19 -19
- 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 +66 -62
- data/doc/rdoc/classes/Wee.html +63 -2
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README.html +6 -9
- 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 +101 -0
- data/doc/rdoc/files/lib/wee/components_rb.html +108 -0
- data/doc/rdoc/files/lib/wee/core/callback_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/core/component_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/core/decoration_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/core_rb.html +3 -3
- 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/requesthandler_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/session_rb.html +2 -1
- data/doc/rdoc/files/lib/wee/utils/autoreload_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/utils/helper_rb.html +108 -0
- data/doc/rdoc/files/lib/wee_rb.html +2 -1
- data/doc/rdoc/fr_class_index.html +3 -1
- data/doc/rdoc/fr_file_index.html +4 -0
- data/doc/rdoc/fr_method_index.html +203 -191
- data/examples/example.rb +2 -16
- data/examples/test.rb +15 -18
- data/lib/wee/adaptors/webrick.rb +3 -1
- data/lib/wee/application.rb +55 -19
- data/lib/wee/components/page_decoration.rb +14 -0
- data/lib/wee/components.rb +1 -0
- data/lib/wee/core/callback.rb +1 -1
- data/lib/wee/core/component.rb +27 -3
- data/lib/wee/core/decoration.rb +9 -0
- data/lib/wee/renderer/html/brushes.rb +21 -23
- data/lib/wee/renderer/html/canvas.rb +25 -4
- data/lib/wee/requesthandler.rb +1 -0
- data/lib/wee/session.rb +21 -1
- data/lib/wee/utils/autoreload.rb +27 -0
- data/lib/wee/utils/helper.rb +15 -0
- data/lib/wee.rb +2 -1
- metadata +203 -191
- data/test/components/page_decoration.rb +0 -7
|
@@ -88,11 +88,11 @@
|
|
|
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="#
|
|
95
|
-
<a href="#
|
|
91
|
+
<a href="#M000220">alive?</a>
|
|
92
|
+
<a href="#M000221">handle_request</a>
|
|
93
|
+
<a href="#M000223">new</a>
|
|
94
|
+
<a href="#M000222">statistics</a>
|
|
95
|
+
<a href="#M000219">teminate</a>
|
|
96
96
|
</div>
|
|
97
97
|
</div>
|
|
98
98
|
|
|
@@ -175,23 +175,24 @@ The maximum number of requests this handler should serve. A value of
|
|
|
175
175
|
<div id="methods">
|
|
176
176
|
<h3 class="section-bar">Public Class methods</h3>
|
|
177
177
|
|
|
178
|
-
<div id="method-
|
|
179
|
-
<a name="
|
|
178
|
+
<div id="method-M000223" class="method-detail">
|
|
179
|
+
<a name="M000223"></a>
|
|
180
180
|
|
|
181
181
|
<div class="method-heading">
|
|
182
|
-
<a href="#
|
|
182
|
+
<a href="#M000223" class="method-signature">
|
|
183
183
|
<span class="method-name">new</span><span class="method-args">()</span>
|
|
184
184
|
</a>
|
|
185
185
|
</div>
|
|
186
186
|
|
|
187
187
|
<div class="method-description">
|
|
188
188
|
<p><a class="source-toggle" href="#"
|
|
189
|
-
onclick="toggleCode('
|
|
190
|
-
<div class="method-source-code" id="
|
|
189
|
+
onclick="toggleCode('M000223-source');return false;">[Source]</a></p>
|
|
190
|
+
<div class="method-source-code" id="M000223-source">
|
|
191
191
|
<pre>
|
|
192
192
|
<span class="ruby-comment cmt"># File lib/wee/requesthandler.rb, line 71</span>
|
|
193
193
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
|
|
194
194
|
<span class="ruby-ivar">@last_access</span> = <span class="ruby-ivar">@creation_time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
|
195
|
+
<span class="ruby-ivar">@expire_after</span> = <span class="ruby-value">30</span><span class="ruby-operator">*</span><span class="ruby-value">60</span> <span class="ruby-comment cmt"># The default is 30 minutes of inactivity</span>
|
|
195
196
|
<span class="ruby-ivar">@request_count</span> = <span class="ruby-value">0</span>
|
|
196
197
|
<span class="ruby-ivar">@running</span> = <span class="ruby-keyword kw">true</span>
|
|
197
198
|
<span class="ruby-keyword kw">end</span>
|
|
@@ -202,11 +203,11 @@ The maximum number of requests this handler should serve. A value of
|
|
|
202
203
|
|
|
203
204
|
<h3 class="section-bar">Public Instance methods</h3>
|
|
204
205
|
|
|
205
|
-
<div id="method-
|
|
206
|
-
<a name="
|
|
206
|
+
<div id="method-M000220" class="method-detail">
|
|
207
|
+
<a name="M000220"></a>
|
|
207
208
|
|
|
208
209
|
<div class="method-heading">
|
|
209
|
-
<a href="#
|
|
210
|
+
<a href="#M000220" class="method-signature">
|
|
210
211
|
<span class="method-name">alive?</span><span class="method-args">()</span>
|
|
211
212
|
</a>
|
|
212
213
|
</div>
|
|
@@ -216,8 +217,8 @@ The maximum number of requests this handler should serve. A value of
|
|
|
216
217
|
Query whether this handler is still alive.
|
|
217
218
|
</p>
|
|
218
219
|
<p><a class="source-toggle" href="#"
|
|
219
|
-
onclick="toggleCode('
|
|
220
|
-
<div class="method-source-code" id="
|
|
220
|
+
onclick="toggleCode('M000220-source');return false;">[Source]</a></p>
|
|
221
|
+
<div class="method-source-code" id="M000220-source">
|
|
221
222
|
<pre>
|
|
222
223
|
<span class="ruby-comment cmt"># File lib/wee/requesthandler.rb, line 40</span>
|
|
223
224
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">alive?</span>
|
|
@@ -237,23 +238,23 @@ Query whether this handler is still alive.
|
|
|
237
238
|
</div>
|
|
238
239
|
</div>
|
|
239
240
|
|
|
240
|
-
<div id="method-
|
|
241
|
-
<a name="
|
|
241
|
+
<div id="method-M000221" class="method-detail">
|
|
242
|
+
<a name="M000221"></a>
|
|
242
243
|
|
|
243
244
|
<div class="method-heading">
|
|
244
|
-
<a href="#
|
|
245
|
+
<a href="#M000221" class="method-signature">
|
|
245
246
|
<span class="method-name">handle_request</span><span class="method-args">(context)</span>
|
|
246
247
|
</a>
|
|
247
248
|
</div>
|
|
248
249
|
|
|
249
250
|
<div class="method-description">
|
|
250
251
|
<p>
|
|
251
|
-
Extend <a href="RequestHandler.html#
|
|
252
|
+
Extend <a href="RequestHandler.html#M000221">handle_request</a> in your own
|
|
252
253
|
subclass.
|
|
253
254
|
</p>
|
|
254
255
|
<p><a class="source-toggle" href="#"
|
|
255
|
-
onclick="toggleCode('
|
|
256
|
-
<div class="method-source-code" id="
|
|
256
|
+
onclick="toggleCode('M000221-source');return false;">[Source]</a></p>
|
|
257
|
+
<div class="method-source-code" id="M000221-source">
|
|
257
258
|
<pre>
|
|
258
259
|
<span class="ruby-comment cmt"># File lib/wee/requesthandler.rb, line 55</span>
|
|
259
260
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_request</span>(<span class="ruby-identifier">context</span>)
|
|
@@ -265,19 +266,19 @@ subclass.
|
|
|
265
266
|
</div>
|
|
266
267
|
</div>
|
|
267
268
|
|
|
268
|
-
<div id="method-
|
|
269
|
-
<a name="
|
|
269
|
+
<div id="method-M000222" class="method-detail">
|
|
270
|
+
<a name="M000222"></a>
|
|
270
271
|
|
|
271
272
|
<div class="method-heading">
|
|
272
|
-
<a href="#
|
|
273
|
+
<a href="#M000222" class="method-signature">
|
|
273
274
|
<span class="method-name">statistics</span><span class="method-args">()</span>
|
|
274
275
|
</a>
|
|
275
276
|
</div>
|
|
276
277
|
|
|
277
278
|
<div class="method-description">
|
|
278
279
|
<p><a class="source-toggle" href="#"
|
|
279
|
-
onclick="toggleCode('
|
|
280
|
-
<div class="method-source-code" id="
|
|
280
|
+
onclick="toggleCode('M000222-source');return false;">[Source]</a></p>
|
|
281
|
+
<div class="method-source-code" id="M000222-source">
|
|
281
282
|
<pre>
|
|
282
283
|
<span class="ruby-comment cmt"># File lib/wee/requesthandler.rb, line 60</span>
|
|
283
284
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">statistics</span>
|
|
@@ -295,11 +296,11 @@ subclass.
|
|
|
295
296
|
</div>
|
|
296
297
|
</div>
|
|
297
298
|
|
|
298
|
-
<div id="method-
|
|
299
|
-
<a name="
|
|
299
|
+
<div id="method-M000219" class="method-detail">
|
|
300
|
+
<a name="M000219"></a>
|
|
300
301
|
|
|
301
302
|
<div class="method-heading">
|
|
302
|
-
<a href="#
|
|
303
|
+
<a href="#M000219" class="method-signature">
|
|
303
304
|
<span class="method-name">teminate</span><span class="method-args">()</span>
|
|
304
305
|
</a>
|
|
305
306
|
</div>
|
|
@@ -309,8 +310,8 @@ subclass.
|
|
|
309
310
|
Terminates the handler.
|
|
310
311
|
</p>
|
|
311
312
|
<p><a class="source-toggle" href="#"
|
|
312
|
-
onclick="toggleCode('
|
|
313
|
-
<div class="method-source-code" id="
|
|
313
|
+
onclick="toggleCode('M000219-source');return false;">[Source]</a></p>
|
|
314
|
+
<div class="method-source-code" id="M000219-source">
|
|
314
315
|
<pre>
|
|
315
316
|
<span class="ruby-comment cmt"># File lib/wee/requesthandler.rb, line 34</span>
|
|
316
317
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">teminate</span>
|
|
@@ -88,10 +88,10 @@
|
|
|
88
88
|
<h3 class="section-bar">Methods</h3>
|
|
89
89
|
|
|
90
90
|
<div class="name-list">
|
|
91
|
-
<a href="#
|
|
92
|
-
<a href="#
|
|
93
|
-
<a href="#
|
|
94
|
-
<a href="#
|
|
91
|
+
<a href="#M000155"><<</a>
|
|
92
|
+
<a href="#M000153">content_type</a>
|
|
93
|
+
<a href="#M000154">content_type=</a>
|
|
94
|
+
<a href="#M000152">new</a>
|
|
95
95
|
</div>
|
|
96
96
|
</div>
|
|
97
97
|
|
|
@@ -149,19 +149,19 @@
|
|
|
149
149
|
<div id="methods">
|
|
150
150
|
<h3 class="section-bar">Public Class methods</h3>
|
|
151
151
|
|
|
152
|
-
<div id="method-
|
|
153
|
-
<a name="
|
|
152
|
+
<div id="method-M000152" class="method-detail">
|
|
153
|
+
<a name="M000152"></a>
|
|
154
154
|
|
|
155
155
|
<div class="method-heading">
|
|
156
|
-
<a href="#
|
|
156
|
+
<a href="#M000152" class="method-signature">
|
|
157
157
|
<span class="method-name">new</span><span class="method-args">(mime_type = 'text/html', content='')</span>
|
|
158
158
|
</a>
|
|
159
159
|
</div>
|
|
160
160
|
|
|
161
161
|
<div class="method-description">
|
|
162
162
|
<p><a class="source-toggle" href="#"
|
|
163
|
-
onclick="toggleCode('
|
|
164
|
-
<div class="method-source-code" id="
|
|
163
|
+
onclick="toggleCode('M000152-source');return false;">[Source]</a></p>
|
|
164
|
+
<div class="method-source-code" id="M000152-source">
|
|
165
165
|
<pre>
|
|
166
166
|
<span class="ruby-comment cmt"># File lib/wee/response.rb, line 9</span>
|
|
167
167
|
<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>)
|
|
@@ -176,19 +176,19 @@
|
|
|
176
176
|
|
|
177
177
|
<h3 class="section-bar">Public Instance methods</h3>
|
|
178
178
|
|
|
179
|
-
<div id="method-
|
|
180
|
-
<a name="
|
|
179
|
+
<div id="method-M000155" class="method-detail">
|
|
180
|
+
<a name="M000155"></a>
|
|
181
181
|
|
|
182
182
|
<div class="method-heading">
|
|
183
|
-
<a href="#
|
|
183
|
+
<a href="#M000155" class="method-signature">
|
|
184
184
|
<span class="method-name"><<</span><span class="method-args">(str)</span>
|
|
185
185
|
</a>
|
|
186
186
|
</div>
|
|
187
187
|
|
|
188
188
|
<div class="method-description">
|
|
189
189
|
<p><a class="source-toggle" href="#"
|
|
190
|
-
onclick="toggleCode('
|
|
191
|
-
<div class="method-source-code" id="
|
|
190
|
+
onclick="toggleCode('M000155-source');return false;">[Source]</a></p>
|
|
191
|
+
<div class="method-source-code" id="M000155-source">
|
|
192
192
|
<pre>
|
|
193
193
|
<span class="ruby-comment cmt"># File lib/wee/response.rb, line 23</span>
|
|
194
194
|
<span class="ruby-keyword kw">def</span> <span class="ruby-operator"><<</span>(<span class="ruby-identifier">str</span>)
|
|
@@ -199,19 +199,19 @@
|
|
|
199
199
|
</div>
|
|
200
200
|
</div>
|
|
201
201
|
|
|
202
|
-
<div id="method-
|
|
203
|
-
<a name="
|
|
202
|
+
<div id="method-M000153" class="method-detail">
|
|
203
|
+
<a name="M000153"></a>
|
|
204
204
|
|
|
205
205
|
<div class="method-heading">
|
|
206
|
-
<a href="#
|
|
206
|
+
<a href="#M000153" class="method-signature">
|
|
207
207
|
<span class="method-name">content_type</span><span class="method-args">()</span>
|
|
208
208
|
</a>
|
|
209
209
|
</div>
|
|
210
210
|
|
|
211
211
|
<div class="method-description">
|
|
212
212
|
<p><a class="source-toggle" href="#"
|
|
213
|
-
onclick="toggleCode('
|
|
214
|
-
<div class="method-source-code" id="
|
|
213
|
+
onclick="toggleCode('M000153-source');return false;">[Source]</a></p>
|
|
214
|
+
<div class="method-source-code" id="M000153-source">
|
|
215
215
|
<pre>
|
|
216
216
|
<span class="ruby-comment cmt"># File lib/wee/response.rb, line 15</span>
|
|
217
217
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content_type</span>
|
|
@@ -222,19 +222,19 @@
|
|
|
222
222
|
</div>
|
|
223
223
|
</div>
|
|
224
224
|
|
|
225
|
-
<div id="method-
|
|
226
|
-
<a name="
|
|
225
|
+
<div id="method-M000154" class="method-detail">
|
|
226
|
+
<a name="M000154"></a>
|
|
227
227
|
|
|
228
228
|
<div class="method-heading">
|
|
229
|
-
<a href="#
|
|
229
|
+
<a href="#M000154" class="method-signature">
|
|
230
230
|
<span class="method-name">content_type=</span><span class="method-args">(mime_type)</span>
|
|
231
231
|
</a>
|
|
232
232
|
</div>
|
|
233
233
|
|
|
234
234
|
<div class="method-description">
|
|
235
235
|
<p><a class="source-toggle" href="#"
|
|
236
|
-
onclick="toggleCode('
|
|
237
|
-
<div class="method-source-code" id="
|
|
236
|
+
onclick="toggleCode('M000154-source');return false;">[Source]</a></p>
|
|
237
|
+
<div class="method-source-code" id="M000154-source">
|
|
238
238
|
<pre>
|
|
239
239
|
<span class="ruby-comment cmt"># File lib/wee/response.rb, line 19</span>
|
|
240
240
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content_type=</span>(<span class="ruby-identifier">mime_type</span>)
|
|
@@ -88,15 +88,15 @@
|
|
|
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="#
|
|
95
|
-
<a href="#
|
|
96
|
-
<a href="#
|
|
97
|
-
<a href="#
|
|
98
|
-
<a href="#
|
|
99
|
-
<a href="#
|
|
91
|
+
<a href="#M000136">create_page</a>
|
|
92
|
+
<a href="#M000131">current</a>
|
|
93
|
+
<a href="#M000138">handle_new_page_view</a>
|
|
94
|
+
<a href="#M000134">handle_request</a>
|
|
95
|
+
<a href="#M000132">new</a>
|
|
96
|
+
<a href="#M000137">process_request</a>
|
|
97
|
+
<a href="#M000139">respond</a>
|
|
98
|
+
<a href="#M000133">snapshot</a>
|
|
99
|
+
<a href="#M000135">start_request_response_loop</a>
|
|
100
100
|
</div>
|
|
101
101
|
</div>
|
|
102
102
|
|
|
@@ -136,21 +136,21 @@
|
|
|
136
136
|
<div id="methods">
|
|
137
137
|
<h3 class="section-bar">Public Class methods</h3>
|
|
138
138
|
|
|
139
|
-
<div id="method-
|
|
140
|
-
<a name="
|
|
139
|
+
<div id="method-M000131" class="method-detail">
|
|
140
|
+
<a name="M000131"></a>
|
|
141
141
|
|
|
142
142
|
<div class="method-heading">
|
|
143
|
-
<a href="#
|
|
143
|
+
<a href="#M000131" class="method-signature">
|
|
144
144
|
<span class="method-name">current</span><span class="method-args">()</span>
|
|
145
145
|
</a>
|
|
146
146
|
</div>
|
|
147
147
|
|
|
148
148
|
<div class="method-description">
|
|
149
149
|
<p><a class="source-toggle" href="#"
|
|
150
|
-
onclick="toggleCode('
|
|
151
|
-
<div class="method-source-code" id="
|
|
150
|
+
onclick="toggleCode('M000131-source');return false;">[Source]</a></p>
|
|
151
|
+
<div class="method-source-code" id="M000131-source">
|
|
152
152
|
<pre>
|
|
153
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
|
153
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 8</span>
|
|
154
154
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">current</span>
|
|
155
155
|
<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>]
|
|
156
156
|
<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>
|
|
@@ -161,21 +161,21 @@
|
|
|
161
161
|
</div>
|
|
162
162
|
</div>
|
|
163
163
|
|
|
164
|
-
<div id="method-
|
|
165
|
-
<a name="
|
|
164
|
+
<div id="method-M000132" class="method-detail">
|
|
165
|
+
<a name="M000132"></a>
|
|
166
166
|
|
|
167
167
|
<div class="method-heading">
|
|
168
|
-
<a href="#
|
|
168
|
+
<a href="#M000132" class="method-signature">
|
|
169
169
|
<span class="method-name">new</span><span class="method-args">(&block)</span>
|
|
170
170
|
</a>
|
|
171
171
|
</div>
|
|
172
172
|
|
|
173
173
|
<div class="method-description">
|
|
174
174
|
<p><a class="source-toggle" href="#"
|
|
175
|
-
onclick="toggleCode('
|
|
176
|
-
<div class="method-source-code" id="
|
|
175
|
+
onclick="toggleCode('M000132-source');return false;">[Source]</a></p>
|
|
176
|
+
<div class="method-source-code" id="M000132-source">
|
|
177
177
|
<pre>
|
|
178
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
|
178
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 14</span>
|
|
179
179
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
|
180
180
|
<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>
|
|
181
181
|
|
|
@@ -201,21 +201,21 @@
|
|
|
201
201
|
|
|
202
202
|
<h3 class="section-bar">Public Instance methods</h3>
|
|
203
203
|
|
|
204
|
-
<div id="method-
|
|
205
|
-
<a name="
|
|
204
|
+
<div id="method-M000136" class="method-detail">
|
|
205
|
+
<a name="M000136"></a>
|
|
206
206
|
|
|
207
207
|
<div class="method-heading">
|
|
208
|
-
<a href="#
|
|
208
|
+
<a href="#M000136" class="method-signature">
|
|
209
209
|
<span class="method-name">create_page</span><span class="method-args">(snapshot)</span>
|
|
210
210
|
</a>
|
|
211
211
|
</div>
|
|
212
212
|
|
|
213
213
|
<div class="method-description">
|
|
214
214
|
<p><a class="source-toggle" href="#"
|
|
215
|
-
onclick="toggleCode('
|
|
216
|
-
<div class="method-source-code" id="
|
|
215
|
+
onclick="toggleCode('M000136-source');return false;">[Source]</a></p>
|
|
216
|
+
<div class="method-source-code" id="M000136-source">
|
|
217
217
|
<pre>
|
|
218
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
|
218
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 85</span>
|
|
219
219
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_page</span>(<span class="ruby-identifier">snapshot</span>)
|
|
220
220
|
<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>
|
|
221
221
|
<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>))
|
|
@@ -225,11 +225,11 @@
|
|
|
225
225
|
</div>
|
|
226
226
|
</div>
|
|
227
227
|
|
|
228
|
-
<div id="method-
|
|
229
|
-
<a name="
|
|
228
|
+
<div id="method-M000134" class="method-detail">
|
|
229
|
+
<a name="M000134"></a>
|
|
230
230
|
|
|
231
231
|
<div class="method-heading">
|
|
232
|
-
<a href="#
|
|
232
|
+
<a href="#M000134" class="method-signature">
|
|
233
233
|
<span class="method-name">handle_request</span><span class="method-args">(context)</span>
|
|
234
234
|
</a>
|
|
235
235
|
</div>
|
|
@@ -239,10 +239,10 @@
|
|
|
239
239
|
called by application to send the session a request
|
|
240
240
|
</p>
|
|
241
241
|
<p><a class="source-toggle" href="#"
|
|
242
|
-
onclick="toggleCode('
|
|
243
|
-
<div class="method-source-code" id="
|
|
242
|
+
onclick="toggleCode('M000134-source');return false;">[Source]</a></p>
|
|
243
|
+
<div class="method-source-code" id="M000134-source">
|
|
244
244
|
<pre>
|
|
245
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
|
245
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 39</span>
|
|
246
246
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_request</span>(<span class="ruby-identifier">context</span>)
|
|
247
247
|
<span class="ruby-keyword kw">super</span>
|
|
248
248
|
|
|
@@ -258,21 +258,21 @@ called by application to send the session a request
|
|
|
258
258
|
</div>
|
|
259
259
|
</div>
|
|
260
260
|
|
|
261
|
-
<div id="method-
|
|
262
|
-
<a name="
|
|
261
|
+
<div id="method-M000137" class="method-detail">
|
|
262
|
+
<a name="M000137"></a>
|
|
263
263
|
|
|
264
264
|
<div class="method-heading">
|
|
265
|
-
<a href="#
|
|
265
|
+
<a href="#M000137" class="method-signature">
|
|
266
266
|
<span class="method-name">process_request</span><span class="method-args">()</span>
|
|
267
267
|
</a>
|
|
268
268
|
</div>
|
|
269
269
|
|
|
270
270
|
<div class="method-description">
|
|
271
271
|
<p><a class="source-toggle" href="#"
|
|
272
|
-
onclick="toggleCode('
|
|
273
|
-
<div class="method-source-code" id="
|
|
272
|
+
onclick="toggleCode('M000137-source');return false;">[Source]</a></p>
|
|
273
|
+
<div class="method-source-code" id="M000137-source">
|
|
274
274
|
<pre>
|
|
275
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
|
275
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 90</span>
|
|
276
276
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_request</span>
|
|
277
277
|
<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>
|
|
278
278
|
|
|
@@ -340,21 +340,21 @@ called by application to send the session a request
|
|
|
340
340
|
</div>
|
|
341
341
|
</div>
|
|
342
342
|
|
|
343
|
-
<div id="method-
|
|
344
|
-
<a name="
|
|
343
|
+
<div id="method-M000133" class="method-detail">
|
|
344
|
+
<a name="M000133"></a>
|
|
345
345
|
|
|
346
346
|
<div class="method-heading">
|
|
347
|
-
<a href="#
|
|
347
|
+
<a href="#M000133" class="method-signature">
|
|
348
348
|
<span class="method-name">snapshot</span><span class="method-args">()</span>
|
|
349
349
|
</a>
|
|
350
350
|
</div>
|
|
351
351
|
|
|
352
352
|
<div class="method-description">
|
|
353
353
|
<p><a class="source-toggle" href="#"
|
|
354
|
-
onclick="toggleCode('
|
|
355
|
-
<div class="method-source-code" id="
|
|
354
|
+
onclick="toggleCode('M000133-source');return false;">[Source]</a></p>
|
|
355
|
+
<div class="method-source-code" id="M000133-source">
|
|
356
356
|
<pre>
|
|
357
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
|
357
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 33</span>
|
|
358
358
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">snapshot</span>
|
|
359
359
|
<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>)
|
|
360
360
|
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">snap</span>.<span class="ruby-identifier">freeze</span>
|
|
@@ -364,27 +364,45 @@ called by application to send the session a request
|
|
|
364
364
|
</div>
|
|
365
365
|
</div>
|
|
366
366
|
|
|
367
|
-
<div id="method-
|
|
368
|
-
<a name="
|
|
367
|
+
<div id="method-M000135" class="method-detail">
|
|
368
|
+
<a name="M000135"></a>
|
|
369
369
|
|
|
370
370
|
<div class="method-heading">
|
|
371
|
-
<a href="#
|
|
371
|
+
<a href="#M000135" class="method-signature">
|
|
372
372
|
<span class="method-name">start_request_response_loop</span><span class="method-args">()</span>
|
|
373
373
|
</a>
|
|
374
374
|
</div>
|
|
375
375
|
|
|
376
376
|
<div class="method-description">
|
|
377
377
|
<p><a class="source-toggle" href="#"
|
|
378
|
-
onclick="toggleCode('
|
|
379
|
-
<div class="method-source-code" id="
|
|
378
|
+
onclick="toggleCode('M000135-source');return false;">[Source]</a></p>
|
|
379
|
+
<div class="method-source-code" id="M000135-source">
|
|
380
380
|
<pre>
|
|
381
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
|
381
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 50</span>
|
|
382
382
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start_request_response_loop</span>
|
|
383
383
|
<span class="ruby-constant">Thread</span>.<span class="ruby-identifier">abort_on_exception</span> = <span class="ruby-keyword kw">true</span>
|
|
384
384
|
<span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> {
|
|
385
385
|
<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>
|
|
386
386
|
<span class="ruby-identifier">loop</span> {
|
|
387
|
-
<span class="ruby-ivar">@context</span> = <span class="ruby-
|
|
387
|
+
<span class="ruby-ivar">@context</span> = <span class="ruby-keyword kw">nil</span>
|
|
388
|
+
|
|
389
|
+
<span class="ruby-comment cmt"># get a request, check whether this session is alive after every 5</span>
|
|
390
|
+
<span class="ruby-comment cmt"># seconds.</span>
|
|
391
|
+
<span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">nil?</span>
|
|
392
|
+
<span class="ruby-keyword kw">begin</span>
|
|
393
|
+
<span class="ruby-constant">Timeout</span>.<span class="ruby-identifier">timeout</span>(<span class="ruby-value">5</span>) {
|
|
394
|
+
<span class="ruby-ivar">@context</span> = <span class="ruby-ivar">@in_queue</span>.<span class="ruby-identifier">pop</span>
|
|
395
|
+
}
|
|
396
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Timeout</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span>
|
|
397
|
+
<span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">alive?</span>
|
|
398
|
+
<span class="ruby-keyword kw">end</span>
|
|
399
|
+
<span class="ruby-keyword kw">end</span>
|
|
400
|
+
|
|
401
|
+
<span class="ruby-comment cmt"># abort thread if no longer alive</span>
|
|
402
|
+
<span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">alive?</span>
|
|
403
|
+
|
|
404
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"invalid request"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">nil?</span>
|
|
405
|
+
|
|
388
406
|
<span class="ruby-keyword kw">begin</span>
|
|
389
407
|
<span class="ruby-identifier">process_request</span>
|
|
390
408
|
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">exn</span>
|
|
@@ -392,6 +410,7 @@ called by application to send the session a request
|
|
|
392
410
|
<span class="ruby-keyword kw">end</span>
|
|
393
411
|
<span class="ruby-ivar">@out_queue</span>.<span class="ruby-identifier">push</span>(<span class="ruby-ivar">@context</span>)
|
|
394
412
|
}
|
|
413
|
+
<span class="ruby-identifier">p</span> <span class="ruby-value str">"session loop terminated"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
|
|
395
414
|
}
|
|
396
415
|
<span class="ruby-keyword kw">end</span>
|
|
397
416
|
</pre>
|
|
@@ -401,21 +420,21 @@ called by application to send the session a request
|
|
|
401
420
|
|
|
402
421
|
<h3 class="section-bar">Private Instance methods</h3>
|
|
403
422
|
|
|
404
|
-
<div id="method-
|
|
405
|
-
<a name="
|
|
423
|
+
<div id="method-M000138" class="method-detail">
|
|
424
|
+
<a name="M000138"></a>
|
|
406
425
|
|
|
407
426
|
<div class="method-heading">
|
|
408
|
-
<a href="#
|
|
427
|
+
<a href="#M000138" class="method-signature">
|
|
409
428
|
<span class="method-name">handle_new_page_view</span><span class="method-args">(context, snapshot=nil)</span>
|
|
410
429
|
</a>
|
|
411
430
|
</div>
|
|
412
431
|
|
|
413
432
|
<div class="method-description">
|
|
414
433
|
<p><a class="source-toggle" href="#"
|
|
415
|
-
onclick="toggleCode('
|
|
416
|
-
<div class="method-source-code" id="
|
|
434
|
+
onclick="toggleCode('M000138-source');return false;">[Source]</a></p>
|
|
435
|
+
<div class="method-source-code" id="M000138-source">
|
|
417
436
|
<pre>
|
|
418
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
|
437
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 155</span>
|
|
419
438
|
<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>)
|
|
420
439
|
<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>
|
|
421
440
|
<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>())
|
|
@@ -428,21 +447,21 @@ called by application to send the session a request
|
|
|
428
447
|
</div>
|
|
429
448
|
</div>
|
|
430
449
|
|
|
431
|
-
<div id="method-
|
|
432
|
-
<a name="
|
|
450
|
+
<div id="method-M000139" class="method-detail">
|
|
451
|
+
<a name="M000139"></a>
|
|
433
452
|
|
|
434
453
|
<div class="method-heading">
|
|
435
|
-
<a href="#
|
|
454
|
+
<a href="#M000139" class="method-signature">
|
|
436
455
|
<span class="method-name">respond</span><span class="method-args">(context, callbacks)</span>
|
|
437
456
|
</a>
|
|
438
457
|
</div>
|
|
439
458
|
|
|
440
459
|
<div class="method-description">
|
|
441
460
|
<p><a class="source-toggle" href="#"
|
|
442
|
-
onclick="toggleCode('
|
|
443
|
-
<div class="method-source-code" id="
|
|
461
|
+
onclick="toggleCode('M000139-source');return false;">[Source]</a></p>
|
|
462
|
+
<div class="method-source-code" id="M000139-source">
|
|
444
463
|
<pre>
|
|
445
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
|
464
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 163</span>
|
|
446
465
|
<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>)
|
|
447
466
|
<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">GenericResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'text/html'</span>, <span class="ruby-value str">''</span>)
|
|
448
467
|
|