wee 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,7 +88,7 @@
|
|
88
88
|
<h3 class="section-bar">Methods</h3>
|
89
89
|
|
90
90
|
<div class="name-list">
|
91
|
-
<a href="#
|
91
|
+
<a href="#M000268">new</a>
|
92
92
|
</div>
|
93
93
|
</div>
|
94
94
|
|
@@ -110,21 +110,21 @@
|
|
110
110
|
<div id="methods">
|
111
111
|
<h3 class="section-bar">Public Class methods</h3>
|
112
112
|
|
113
|
-
<div id="method-
|
114
|
-
<a name="
|
113
|
+
<div id="method-M000268" class="method-detail">
|
114
|
+
<a name="M000268"></a>
|
115
115
|
|
116
116
|
<div class="method-heading">
|
117
|
-
<a href="#
|
117
|
+
<a href="#M000268" class="method-signature">
|
118
118
|
<span class="method-name">new</span><span class="method-args">(location)</span>
|
119
119
|
</a>
|
120
120
|
</div>
|
121
121
|
|
122
122
|
<div class="method-description">
|
123
123
|
<p><a class="source-toggle" href="#"
|
124
|
-
onclick="toggleCode('
|
125
|
-
<div class="method-source-code" id="
|
124
|
+
onclick="toggleCode('M000268-source');return false;">[Source]</a></p>
|
125
|
+
<div class="method-source-code" id="M000268-source">
|
126
126
|
<pre>
|
127
|
-
<span class="ruby-comment cmt"># File lib/wee/response.rb, line
|
127
|
+
<span class="ruby-comment cmt"># File lib/wee/response.rb, line 48</span>
|
128
128
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">location</span>)
|
129
129
|
<span class="ruby-keyword kw">super</span>(<span class="ruby-value str">'text/html'</span>, <span class="ruby-node">%[<title>302 - Redirect</title><h1>302 - Redirect</h1><p>You are being redirected to <a href="#{location}">#{location}</a>]</span>)
|
130
130
|
<span class="ruby-ivar">@status</span> = <span class="ruby-value">302</span>
|
@@ -88,7 +88,7 @@
|
|
88
88
|
<h3 class="section-bar">Methods</h3>
|
89
89
|
|
90
90
|
<div class="name-list">
|
91
|
-
<a href="#
|
91
|
+
<a href="#M000243">new</a>
|
92
92
|
</div>
|
93
93
|
</div>
|
94
94
|
|
@@ -110,21 +110,21 @@
|
|
110
110
|
<div id="methods">
|
111
111
|
<h3 class="section-bar">Public Class methods</h3>
|
112
112
|
|
113
|
-
<div id="method-
|
114
|
-
<a name="
|
113
|
+
<div id="method-M000243" class="method-detail">
|
114
|
+
<a name="M000243"></a>
|
115
115
|
|
116
116
|
<div class="method-heading">
|
117
|
-
<a href="#
|
117
|
+
<a href="#M000243" class="method-signature">
|
118
118
|
<span class="method-name">new</span><span class="method-args">(message, location, seconds=10)</span>
|
119
119
|
</a>
|
120
120
|
</div>
|
121
121
|
|
122
122
|
<div class="method-description">
|
123
123
|
<p><a class="source-toggle" href="#"
|
124
|
-
onclick="toggleCode('
|
125
|
-
<div class="method-source-code" id="
|
124
|
+
onclick="toggleCode('M000243-source');return false;">[Source]</a></p>
|
125
|
+
<div class="method-source-code" id="M000243-source">
|
126
126
|
<pre>
|
127
|
-
<span class="ruby-comment cmt"># File lib/wee/response.rb, line
|
127
|
+
<span class="ruby-comment cmt"># File lib/wee/response.rb, line 56</span>
|
128
128
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">location</span>, <span class="ruby-identifier">seconds</span>=<span class="ruby-value">10</span>)
|
129
129
|
<span class="ruby-keyword kw">super</span>(<span class="ruby-value str">'text/html'</span>, <span class="ruby-node">%[<html>
|
130
130
|
<head>
|
@@ -100,9 +100,11 @@ NOTE that if there are fields named "xxx" and
|
|
100
100
|
<h3 class="section-bar">Methods</h3>
|
101
101
|
|
102
102
|
<div class="name-list">
|
103
|
-
<a href="#
|
104
|
-
<a href="#
|
105
|
-
<a href="#
|
103
|
+
<a href="#M000278">application_path</a>
|
104
|
+
<a href="#M000279">build_url</a>
|
105
|
+
<a href="#M000277">new</a>
|
106
|
+
<a href="#M000280">parse_fields</a>
|
107
|
+
<a href="#M000281">parse_path</a>
|
106
108
|
</div>
|
107
109
|
</div>
|
108
110
|
|
@@ -114,6 +116,19 @@ NOTE that if there are fields named "xxx" and
|
|
114
116
|
<div id="section">
|
115
117
|
|
116
118
|
|
119
|
+
<div id="constants-list">
|
120
|
+
<h3 class="section-bar">Constants</h3>
|
121
|
+
|
122
|
+
<div class="name-list">
|
123
|
+
<table summary="Constants">
|
124
|
+
<tr class="top-aligned-row context-row">
|
125
|
+
<td class="context-item-name">DELIM</td>
|
126
|
+
<td>=</td>
|
127
|
+
<td class="context-item-value">'=/'</td>
|
128
|
+
</tr>
|
129
|
+
</table>
|
130
|
+
</div>
|
131
|
+
</div>
|
117
132
|
|
118
133
|
|
119
134
|
|
@@ -122,6 +137,11 @@ NOTE that if there are fields named "xxx" and
|
|
122
137
|
|
123
138
|
<div class="name-list">
|
124
139
|
<table>
|
140
|
+
<tr class="top-aligned-row context-row">
|
141
|
+
<td class="context-item-name">cookies</td>
|
142
|
+
<td class="context-item-value"> [R] </td>
|
143
|
+
<td class="context-item-desc"></td>
|
144
|
+
</tr>
|
125
145
|
<tr class="top-aligned-row context-row">
|
126
146
|
<td class="context-item-name">fields</td>
|
127
147
|
<td class="context-item-value"> [R] </td>
|
@@ -134,7 +154,7 @@ NOTE that if there are fields named "xxx" and
|
|
134
154
|
</tr>
|
135
155
|
<tr class="top-aligned-row context-row">
|
136
156
|
<td class="context-item-name">request_handler_id</td>
|
137
|
-
<td class="context-item-value"> [
|
157
|
+
<td class="context-item-value"> [RW] </td>
|
138
158
|
<td class="context-item-desc"></td>
|
139
159
|
</tr>
|
140
160
|
</table>
|
@@ -147,46 +167,25 @@ NOTE that if there are fields named "xxx" and
|
|
147
167
|
<div id="methods">
|
148
168
|
<h3 class="section-bar">Public Class methods</h3>
|
149
169
|
|
150
|
-
<div id="method-
|
151
|
-
<a name="
|
170
|
+
<div id="method-M000277" class="method-detail">
|
171
|
+
<a name="M000277"></a>
|
152
172
|
|
153
173
|
<div class="method-heading">
|
154
|
-
<a href="#
|
155
|
-
<span class="method-name">new</span><span class="method-args">(app_path, path, headers, fields)</span>
|
174
|
+
<a href="#M000277" class="method-signature">
|
175
|
+
<span class="method-name">new</span><span class="method-args">(app_path, path, headers, fields, cookies)</span>
|
156
176
|
</a>
|
157
177
|
</div>
|
158
178
|
|
159
179
|
<div class="method-description">
|
160
180
|
<p><a class="source-toggle" href="#"
|
161
|
-
onclick="toggleCode('
|
162
|
-
<div class="method-source-code" id="
|
181
|
+
onclick="toggleCode('M000277-source');return false;">[Source]</a></p>
|
182
|
+
<div class="method-source-code" id="M000277-source">
|
163
183
|
<pre>
|
164
|
-
<span class="ruby-comment cmt"># File lib/wee/request.rb, line
|
165
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app_path</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">fields</span>)
|
166
|
-
<span class="ruby-ivar">@app_path</span>, <span class="ruby-ivar">@path</span>, <span class="ruby-ivar">@headers</span> = <span class="ruby-identifier">app_path</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">headers</span>
|
167
|
-
|
168
|
-
<span class="ruby-identifier">
|
169
|
-
<span class="ruby-ivar">@fields</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
170
|
-
|
171
|
-
<span class="ruby-comment cmt"># sorted by decreasing key length, e.g. "2.x" comes before "2"</span>
|
172
|
-
<span class="ruby-identifier">fields</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">sort_by</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-operator">-</span><span class="ruby-identifier">k</span>.<span class="ruby-identifier">length</span>}.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
|
173
|
-
<span class="ruby-identifier">val</span> = <span class="ruby-identifier">fields</span>[<span class="ruby-identifier">key</span>]
|
174
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">"."</span>)
|
175
|
-
<span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span> = <span class="ruby-identifier">key</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">"."</span>, <span class="ruby-value">2</span>)
|
176
|
-
<span class="ruby-ivar">@fields</span>[<span class="ruby-identifier">a</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
177
|
-
<span class="ruby-ivar">@fields</span>[<span class="ruby-identifier">a</span>][<span class="ruby-identifier">b</span>] = <span class="ruby-identifier">val</span>
|
178
|
-
<span class="ruby-keyword kw">else</span>
|
179
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@fields</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">key</span>)
|
180
|
-
<span class="ruby-ivar">@fields</span>[<span class="ruby-identifier">key</span>][<span class="ruby-keyword kw">nil</span>] = <span class="ruby-identifier">val</span>
|
181
|
-
<span class="ruby-keyword kw">else</span>
|
182
|
-
<span class="ruby-ivar">@fields</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">val</span>
|
183
|
-
<span class="ruby-keyword kw">end</span>
|
184
|
-
<span class="ruby-keyword kw">end</span>
|
185
|
-
<span class="ruby-keyword kw">end</span>
|
186
|
-
|
187
|
-
<span class="ruby-identifier">full_app_path</span>, <span class="ruby-identifier">req_path</span> = <span class="ruby-ivar">@path</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'@'</span>, <span class="ruby-value">2</span>)
|
188
|
-
<span class="ruby-ivar">@request_handler_id</span> = <span class="ruby-ivar">@page_id</span> = <span class="ruby-keyword kw">nil</span>
|
189
|
-
<span class="ruby-ivar">@request_handler_id</span>, <span class="ruby-ivar">@page_id</span> = <span class="ruby-identifier">req_path</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'/'</span>, <span class="ruby-value">2</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">req_path</span>
|
184
|
+
<span class="ruby-comment cmt"># File lib/wee/request.rb, line 14</span>
|
185
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app_path</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">fields</span>, <span class="ruby-identifier">cookies</span>)
|
186
|
+
<span class="ruby-ivar">@app_path</span>, <span class="ruby-ivar">@path</span>, <span class="ruby-ivar">@headers</span>, <span class="ruby-ivar">@cookies</span> = <span class="ruby-identifier">app_path</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">cookies</span>
|
187
|
+
<span class="ruby-identifier">parse_fields</span>(<span class="ruby-identifier">fields</span>)
|
188
|
+
<span class="ruby-identifier">parse_path</span>
|
190
189
|
<span class="ruby-keyword kw">end</span>
|
191
190
|
</pre>
|
192
191
|
</div>
|
@@ -195,21 +194,21 @@ NOTE that if there are fields named "xxx" and
|
|
195
194
|
|
196
195
|
<h3 class="section-bar">Public Instance methods</h3>
|
197
196
|
|
198
|
-
<div id="method-
|
199
|
-
<a name="
|
197
|
+
<div id="method-M000278" class="method-detail">
|
198
|
+
<a name="M000278"></a>
|
200
199
|
|
201
200
|
<div class="method-heading">
|
202
|
-
<a href="#
|
201
|
+
<a href="#M000278" class="method-signature">
|
203
202
|
<span class="method-name">application_path</span><span class="method-args">()</span>
|
204
203
|
</a>
|
205
204
|
</div>
|
206
205
|
|
207
206
|
<div class="method-description">
|
208
207
|
<p><a class="source-toggle" href="#"
|
209
|
-
onclick="toggleCode('
|
210
|
-
<div class="method-source-code" id="
|
208
|
+
onclick="toggleCode('M000278-source');return false;">[Source]</a></p>
|
209
|
+
<div class="method-source-code" id="M000278-source">
|
211
210
|
<pre>
|
212
|
-
<span class="ruby-comment cmt"># File lib/wee/request.rb, line
|
211
|
+
<span class="ruby-comment cmt"># File lib/wee/request.rb, line 20</span>
|
213
212
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">application_path</span>
|
214
213
|
<span class="ruby-ivar">@app_path</span>
|
215
214
|
<span class="ruby-keyword kw">end</span>
|
@@ -218,21 +217,21 @@ NOTE that if there are fields named "xxx" and
|
|
218
217
|
</div>
|
219
218
|
</div>
|
220
219
|
|
221
|
-
<div id="method-
|
222
|
-
<a name="
|
220
|
+
<div id="method-M000279" class="method-detail">
|
221
|
+
<a name="M000279"></a>
|
223
222
|
|
224
223
|
<div class="method-heading">
|
225
|
-
<a href="#
|
224
|
+
<a href="#M000279" class="method-signature">
|
226
225
|
<span class="method-name">build_url</span><span class="method-args">(request_handler_id=nil, page_id=nil, callback_id=nil)</span>
|
227
226
|
</a>
|
228
227
|
</div>
|
229
228
|
|
230
229
|
<div class="method-description">
|
231
230
|
<p><a class="source-toggle" href="#"
|
232
|
-
onclick="toggleCode('
|
233
|
-
<div class="method-source-code" id="
|
231
|
+
onclick="toggleCode('M000279-source');return false;">[Source]</a></p>
|
232
|
+
<div class="method-source-code" id="M000279-source">
|
234
233
|
<pre>
|
235
|
-
<span class="ruby-comment cmt"># File lib/wee/request.rb, line
|
234
|
+
<span class="ruby-comment cmt"># File lib/wee/request.rb, line 24</span>
|
236
235
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_url</span>(<span class="ruby-identifier">request_handler_id</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">page_id</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">callback_id</span>=<span class="ruby-keyword kw">nil</span>)
|
237
236
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">request_handler_id</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">page_id</span>.<span class="ruby-identifier">nil?</span>
|
238
237
|
|
@@ -241,8 +240,8 @@ NOTE that if there are fields named "xxx" and
|
|
241
240
|
<span class="ruby-identifier">url</span> = <span class="ruby-value str">""</span>
|
242
241
|
<span class="ruby-identifier">url</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@app_path</span>
|
243
242
|
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">arr</span>.<span class="ruby-identifier">empty?</span>
|
244
|
-
<span class="ruby-identifier">url</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">'/'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">url</span>[<span class="ruby-value">-1</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">!=</span> <span class="ruby-value str">'/'</span> <span class="ruby-comment cmt"># /
|
245
|
-
<span class="ruby-identifier">url</span> <span class="ruby-operator"><<</span> (<span class="ruby-
|
243
|
+
<span class="ruby-identifier">url</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">'/'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">url</span>[<span class="ruby-value">-1</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">!=</span> <span class="ruby-value str">'/'</span> <span class="ruby-comment cmt"># /appXXX -> /app/XXX</span>
|
244
|
+
<span class="ruby-identifier">url</span> <span class="ruby-operator"><<</span> (<span class="ruby-constant">DELIM</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">arr</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">'/'</span>))
|
246
245
|
<span class="ruby-keyword kw">end</span>
|
247
246
|
<span class="ruby-identifier">url</span> <span class="ruby-operator"><<</span> (<span class="ruby-value str">'?'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">callback_id</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">callback_id</span>
|
248
247
|
|
@@ -253,6 +252,73 @@ NOTE that if there are fields named "xxx" and
|
|
253
252
|
</div>
|
254
253
|
</div>
|
255
254
|
|
255
|
+
<h3 class="section-bar">Private Instance methods</h3>
|
256
|
+
|
257
|
+
<div id="method-M000280" class="method-detail">
|
258
|
+
<a name="M000280"></a>
|
259
|
+
|
260
|
+
<div class="method-heading">
|
261
|
+
<a href="#M000280" class="method-signature">
|
262
|
+
<span class="method-name">parse_fields</span><span class="method-args">(fields)</span>
|
263
|
+
</a>
|
264
|
+
</div>
|
265
|
+
|
266
|
+
<div class="method-description">
|
267
|
+
<p><a class="source-toggle" href="#"
|
268
|
+
onclick="toggleCode('M000280-source');return false;">[Source]</a></p>
|
269
|
+
<div class="method-source-code" id="M000280-source">
|
270
|
+
<pre>
|
271
|
+
<span class="ruby-comment cmt"># File lib/wee/request.rb, line 42</span>
|
272
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_fields</span>(<span class="ruby-identifier">fields</span>)
|
273
|
+
<span class="ruby-identifier">fields</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
274
|
+
<span class="ruby-ivar">@fields</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
275
|
+
|
276
|
+
<span class="ruby-comment cmt"># sorted by decreasing key length, e.g. "2.x" comes before "2"</span>
|
277
|
+
<span class="ruby-identifier">fields</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">sort_by</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-operator">-</span><span class="ruby-identifier">k</span>.<span class="ruby-identifier">length</span>}.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
|
278
|
+
<span class="ruby-identifier">val</span> = <span class="ruby-identifier">fields</span>[<span class="ruby-identifier">key</span>]
|
279
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">"."</span>)
|
280
|
+
<span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span> = <span class="ruby-identifier">key</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">"."</span>, <span class="ruby-value">2</span>)
|
281
|
+
<span class="ruby-ivar">@fields</span>[<span class="ruby-identifier">a</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
282
|
+
<span class="ruby-ivar">@fields</span>[<span class="ruby-identifier">a</span>][<span class="ruby-identifier">b</span>] = <span class="ruby-identifier">val</span>
|
283
|
+
<span class="ruby-keyword kw">else</span>
|
284
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@fields</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">key</span>)
|
285
|
+
<span class="ruby-ivar">@fields</span>[<span class="ruby-identifier">key</span>][<span class="ruby-keyword kw">nil</span>] = <span class="ruby-identifier">val</span>
|
286
|
+
<span class="ruby-keyword kw">else</span>
|
287
|
+
<span class="ruby-ivar">@fields</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">val</span>
|
288
|
+
<span class="ruby-keyword kw">end</span>
|
289
|
+
<span class="ruby-keyword kw">end</span>
|
290
|
+
<span class="ruby-keyword kw">end</span>
|
291
|
+
<span class="ruby-keyword kw">end</span>
|
292
|
+
</pre>
|
293
|
+
</div>
|
294
|
+
</div>
|
295
|
+
</div>
|
296
|
+
|
297
|
+
<div id="method-M000281" class="method-detail">
|
298
|
+
<a name="M000281"></a>
|
299
|
+
|
300
|
+
<div class="method-heading">
|
301
|
+
<a href="#M000281" class="method-signature">
|
302
|
+
<span class="method-name">parse_path</span><span class="method-args">()</span>
|
303
|
+
</a>
|
304
|
+
</div>
|
305
|
+
|
306
|
+
<div class="method-description">
|
307
|
+
<p><a class="source-toggle" href="#"
|
308
|
+
onclick="toggleCode('M000281-source');return false;">[Source]</a></p>
|
309
|
+
<div class="method-source-code" id="M000281-source">
|
310
|
+
<pre>
|
311
|
+
<span class="ruby-comment cmt"># File lib/wee/request.rb, line 63</span>
|
312
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_path</span>
|
313
|
+
<span class="ruby-identifier">full_app_path</span>, <span class="ruby-identifier">req_path</span> = <span class="ruby-ivar">@path</span>.<span class="ruby-identifier">split</span>(<span class="ruby-constant">DELIM</span>, <span class="ruby-value">2</span>)
|
314
|
+
<span class="ruby-ivar">@request_handler_id</span> = <span class="ruby-ivar">@page_id</span> = <span class="ruby-keyword kw">nil</span>
|
315
|
+
<span class="ruby-ivar">@request_handler_id</span>, <span class="ruby-ivar">@page_id</span> = <span class="ruby-identifier">req_path</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'/'</span>, <span class="ruby-value">2</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">req_path</span>
|
316
|
+
<span class="ruby-keyword kw">end</span>
|
317
|
+
</pre>
|
318
|
+
</div>
|
319
|
+
</div>
|
320
|
+
</div>
|
321
|
+
|
256
322
|
|
257
323
|
</div>
|
258
324
|
|
@@ -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="#M000306">alive?</a>
|
92
|
+
<a href="#M000307">handle_request</a>
|
93
|
+
<a href="#M000309">new</a>
|
94
|
+
<a href="#M000308">statistics</a>
|
95
|
+
<a href="#M000305">teminate</a>
|
96
96
|
</div>
|
97
97
|
</div>
|
98
98
|
|
@@ -175,19 +175,19 @@ 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-M000309" class="method-detail">
|
179
|
+
<a name="M000309"></a>
|
180
180
|
|
181
181
|
<div class="method-heading">
|
182
|
-
<a href="#
|
182
|
+
<a href="#M000309" 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('M000309-source');return false;">[Source]</a></p>
|
190
|
+
<div class="method-source-code" id="M000309-source">
|
191
191
|
<pre>
|
192
192
|
<span class="ruby-comment cmt"># File lib/wee/requesthandler.rb, line 74</span>
|
193
193
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
|
@@ -203,11 +203,11 @@ The maximum number of requests this handler should serve. A value of
|
|
203
203
|
|
204
204
|
<h3 class="section-bar">Public Instance methods</h3>
|
205
205
|
|
206
|
-
<div id="method-
|
207
|
-
<a name="
|
206
|
+
<div id="method-M000306" class="method-detail">
|
207
|
+
<a name="M000306"></a>
|
208
208
|
|
209
209
|
<div class="method-heading">
|
210
|
-
<a href="#
|
210
|
+
<a href="#M000306" class="method-signature">
|
211
211
|
<span class="method-name">alive?</span><span class="method-args">()</span>
|
212
212
|
</a>
|
213
213
|
</div>
|
@@ -217,8 +217,8 @@ The maximum number of requests this handler should serve. A value of
|
|
217
217
|
Query whether this handler is still alive.
|
218
218
|
</p>
|
219
219
|
<p><a class="source-toggle" href="#"
|
220
|
-
onclick="toggleCode('
|
221
|
-
<div class="method-source-code" id="
|
220
|
+
onclick="toggleCode('M000306-source');return false;">[Source]</a></p>
|
221
|
+
<div class="method-source-code" id="M000306-source">
|
222
222
|
<pre>
|
223
223
|
<span class="ruby-comment cmt"># File lib/wee/requesthandler.rb, line 43</span>
|
224
224
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">alive?</span>
|
@@ -238,23 +238,23 @@ Query whether this handler is still alive.
|
|
238
238
|
</div>
|
239
239
|
</div>
|
240
240
|
|
241
|
-
<div id="method-
|
242
|
-
<a name="
|
241
|
+
<div id="method-M000307" class="method-detail">
|
242
|
+
<a name="M000307"></a>
|
243
243
|
|
244
244
|
<div class="method-heading">
|
245
|
-
<a href="#
|
245
|
+
<a href="#M000307" class="method-signature">
|
246
246
|
<span class="method-name">handle_request</span><span class="method-args">(context)</span>
|
247
247
|
</a>
|
248
248
|
</div>
|
249
249
|
|
250
250
|
<div class="method-description">
|
251
251
|
<p>
|
252
|
-
Extend <a href="RequestHandler.html#
|
252
|
+
Extend <a href="RequestHandler.html#M000307">handle_request</a> in your own
|
253
253
|
subclass.
|
254
254
|
</p>
|
255
255
|
<p><a class="source-toggle" href="#"
|
256
|
-
onclick="toggleCode('
|
257
|
-
<div class="method-source-code" id="
|
256
|
+
onclick="toggleCode('M000307-source');return false;">[Source]</a></p>
|
257
|
+
<div class="method-source-code" id="M000307-source">
|
258
258
|
<pre>
|
259
259
|
<span class="ruby-comment cmt"># File lib/wee/requesthandler.rb, line 58</span>
|
260
260
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_request</span>(<span class="ruby-identifier">context</span>)
|
@@ -266,19 +266,19 @@ subclass.
|
|
266
266
|
</div>
|
267
267
|
</div>
|
268
268
|
|
269
|
-
<div id="method-
|
270
|
-
<a name="
|
269
|
+
<div id="method-M000308" class="method-detail">
|
270
|
+
<a name="M000308"></a>
|
271
271
|
|
272
272
|
<div class="method-heading">
|
273
|
-
<a href="#
|
273
|
+
<a href="#M000308" class="method-signature">
|
274
274
|
<span class="method-name">statistics</span><span class="method-args">()</span>
|
275
275
|
</a>
|
276
276
|
</div>
|
277
277
|
|
278
278
|
<div class="method-description">
|
279
279
|
<p><a class="source-toggle" href="#"
|
280
|
-
onclick="toggleCode('
|
281
|
-
<div class="method-source-code" id="
|
280
|
+
onclick="toggleCode('M000308-source');return false;">[Source]</a></p>
|
281
|
+
<div class="method-source-code" id="M000308-source">
|
282
282
|
<pre>
|
283
283
|
<span class="ruby-comment cmt"># File lib/wee/requesthandler.rb, line 63</span>
|
284
284
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">statistics</span>
|
@@ -296,11 +296,11 @@ subclass.
|
|
296
296
|
</div>
|
297
297
|
</div>
|
298
298
|
|
299
|
-
<div id="method-
|
300
|
-
<a name="
|
299
|
+
<div id="method-M000305" class="method-detail">
|
300
|
+
<a name="M000305"></a>
|
301
301
|
|
302
302
|
<div class="method-heading">
|
303
|
-
<a href="#
|
303
|
+
<a href="#M000305" class="method-signature">
|
304
304
|
<span class="method-name">teminate</span><span class="method-args">()</span>
|
305
305
|
</a>
|
306
306
|
</div>
|
@@ -314,8 +314,8 @@ This will usually not immediatly terminate the handler from running, but
|
|
314
314
|
further requests will not be answered.
|
315
315
|
</p>
|
316
316
|
<p><a class="source-toggle" href="#"
|
317
|
-
onclick="toggleCode('
|
318
|
-
<div class="method-source-code" id="
|
317
|
+
onclick="toggleCode('M000305-source');return false;">[Source]</a></p>
|
318
|
+
<div class="method-source-code" id="M000305-source">
|
319
319
|
<pre>
|
320
320
|
<span class="ruby-comment cmt"># File lib/wee/requesthandler.rb, line 37</span>
|
321
321
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">teminate</span>
|