Capcode 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -10,11 +10,16 @@ Capcode is a web microframework
10
10
 
11
11
  == FEATURES/PROBLEMS:
12
12
 
13
+ === 0.6.2
14
+ * Add Markaby, Erb and Haml layout see Capcode::Helpers.render for more informations
15
+ * Add content_for...
16
+ * Major bugs corrections
17
+
13
18
  === 0.6.1
14
19
  * Major bugs corrections in haml and erb renderer ($%&! Windows)
15
20
  * Major bugs corrections in Route.call
16
21
  * Add Markaby layout support
17
- * Rewrite blog-couchdb example
22
+ * Rewrite blog-couchdb example (based on the very sympatic camping example : http://github.com/judofyr/camping/blob/master/examples/blog.rb)
18
23
 
19
24
  === 0.6.0
20
25
  * Add :root option to Capcode.run. This option allow you to specify the root directory for static files
@@ -130,115 +130,115 @@ If the regexp in the route does not match, all arguments will be
130
130
  <p class="source-link">[ <a href="javascript:toggleSource('M000001_source')" id="l_M000001_source">show source</a> ]</p>
131
131
  <div id="M000001_source" class="dyn-source">
132
132
  <pre>
133
- <span class="ruby-comment cmt"># File lib/capcode.rb, line 202</span>
134
- 202: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Route</span> <span class="ruby-operator">*</span><span class="ruby-identifier">u</span>
135
- 203: <span class="ruby-constant">Class</span>.<span class="ruby-identifier">new</span> {
136
- 204: <span class="ruby-identifier">meta_def</span>(<span class="ruby-identifier">:__urls__</span>){
137
- 205: <span class="ruby-comment cmt"># &lt; Route '/hello/world/([^\/]*)/id(\d*)', '/hello/(.*)'</span>
138
- 206: <span class="ruby-comment cmt"># # =&gt; [ {'/hello/world' =&gt; '([^\/]*)/id(\d*)', '/hello' =&gt; '(.*)'}, 2, &lt;Capcode::Klass&gt; ]</span>
139
- 207: <span class="ruby-identifier">h</span> = {}
140
- 208: <span class="ruby-identifier">max</span> = <span class="ruby-value">0</span>
141
- 209: <span class="ruby-identifier">u</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">_u</span><span class="ruby-operator">|</span>
142
- 210: <span class="ruby-identifier">m</span> = <span class="ruby-regexp re">/\/([^\/]*\(.*)/</span>.<span class="ruby-identifier">match</span>( <span class="ruby-identifier">_u</span> )
143
- 211: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">nil?</span>
144
- 212: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">RouteError</span>, <span class="ruby-node">&quot;Route `#{_u}' already defined with regexp `#{h[_u]}' !&quot;</span>, <span class="ruby-identifier">caller</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">h</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">_u</span>)
145
- 213: <span class="ruby-identifier">h</span>[<span class="ruby-identifier">_u</span>] = <span class="ruby-value str">''</span>
146
- 214: <span class="ruby-keyword kw">else</span>
147
- 215: <span class="ruby-identifier">_pre</span> = <span class="ruby-identifier">m</span>.<span class="ruby-identifier">pre_match</span>
148
- 216: <span class="ruby-identifier">_pre</span> = <span class="ruby-value str">&quot;/&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">_pre</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
149
- 217: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">RouteError</span>, <span class="ruby-node">&quot;Route `#{_pre}' already defined with regexp `#{h[_pre]}' !&quot;</span>, <span class="ruby-identifier">caller</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">h</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">_pre</span>)
150
- 218: <span class="ruby-identifier">h</span>[<span class="ruby-identifier">_pre</span>] = <span class="ruby-identifier">m</span>.<span class="ruby-identifier">captures</span>[<span class="ruby-value">0</span>]
151
- 219: <span class="ruby-identifier">max</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">m</span>.<span class="ruby-identifier">captures</span>[<span class="ruby-value">0</span>]).<span class="ruby-identifier">number_of_captures</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">max</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">m</span>.<span class="ruby-identifier">captures</span>[<span class="ruby-value">0</span>]).<span class="ruby-identifier">number_of_captures</span>
152
- 220: <span class="ruby-keyword kw">end</span>
153
- 221: <span class="ruby-keyword kw">end</span>
154
- 222: [<span class="ruby-identifier">h</span>, <span class="ruby-identifier">max</span>, <span class="ruby-keyword kw">self</span>]
155
- 223: }
156
- 224:
157
- 225: <span class="ruby-comment cmt"># Hash containing all the request parameters (GET or POST)</span>
158
- 226: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">params</span>
159
- 227: <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">params</span>
160
- 228: <span class="ruby-keyword kw">end</span>
161
- 229:
162
- 230: <span class="ruby-comment cmt"># Hash containing all the environment variables</span>
163
- 231: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">env</span>
164
- 232: <span class="ruby-ivar">@env</span>
165
- 233: <span class="ruby-keyword kw">end</span>
166
- 234:
167
- 235: <span class="ruby-comment cmt"># Hash session</span>
168
- 236: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">session</span>
169
- 237: <span class="ruby-ivar">@env</span>[<span class="ruby-value str">'rack.session'</span>]
170
- 238: <span class="ruby-keyword kw">end</span>
171
- 239:
172
- 240: <span class="ruby-comment cmt"># Return the Rack::Request object</span>
173
- 241: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">request</span>
174
- 242: <span class="ruby-ivar">@request</span>
175
- 243: <span class="ruby-keyword kw">end</span>
176
- 244:
177
- 245: <span class="ruby-comment cmt"># Return the Rack::Response object</span>
178
- 246: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">response</span>
179
- 247: <span class="ruby-ivar">@response</span>
180
- 248: <span class="ruby-keyword kw">end</span>
181
- 249:
182
- 250: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>( <span class="ruby-identifier">e</span> ) <span class="ruby-comment cmt">#:nodoc:</span>
183
- 251: <span class="ruby-ivar">@env</span> = <span class="ruby-identifier">e</span>
184
- 252: <span class="ruby-ivar">@response</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Response</span>.<span class="ruby-identifier">new</span>
185
- 253: <span class="ruby-ivar">@request</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@env</span>)
186
- 254:
187
- 255: <span class="ruby-identifier">r</span> = <span class="ruby-keyword kw">case</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;REQUEST_METHOD&quot;</span>]
188
- 256: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;GET&quot;</span>
189
- 257: <span class="ruby-identifier">finalPath</span> = <span class="ruby-keyword kw">nil</span>
190
- 258: <span class="ruby-identifier">finalArgs</span> = <span class="ruby-keyword kw">nil</span>
191
- 259: <span class="ruby-identifier">finalNArgs</span> = <span class="ruby-keyword kw">nil</span>
192
- 260:
193
- 261: <span class="ruby-identifier">aPath</span> = <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">gsub</span>( <span class="ruby-regexp re">/^\//</span>, <span class="ruby-value str">&quot;&quot;</span> ).<span class="ruby-identifier">split</span>( <span class="ruby-value str">&quot;/&quot;</span> )
194
- 262: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">__urls__</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span>, <span class="ruby-identifier">r</span><span class="ruby-operator">|</span>
195
- 263: <span class="ruby-identifier">xPath</span> = <span class="ruby-identifier">p</span>.<span class="ruby-identifier">gsub</span>( <span class="ruby-regexp re">/^\//</span>, <span class="ruby-value str">&quot;&quot;</span> ).<span class="ruby-identifier">split</span>( <span class="ruby-value str">&quot;/&quot;</span> )
196
- 264: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">xPath</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">aPath</span>).<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
197
- 265: <span class="ruby-identifier">diffArgs</span> = <span class="ruby-identifier">aPath</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">xPath</span>
198
- 266: <span class="ruby-identifier">diffNArgs</span> = <span class="ruby-identifier">diffArgs</span>.<span class="ruby-identifier">size</span>
199
- 267: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">finalNArgs</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">finalNArgs</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">diffNArgs</span>
200
- 268: <span class="ruby-identifier">finalPath</span> = <span class="ruby-identifier">p</span>
201
- 269: <span class="ruby-identifier">finalNArgs</span> = <span class="ruby-identifier">diffNArgs</span>
202
- 270: <span class="ruby-identifier">finalArgs</span> = <span class="ruby-identifier">diffArgs</span>
203
- 271: <span class="ruby-keyword kw">end</span>
204
- 272: <span class="ruby-keyword kw">end</span>
205
- 273:
206
- 274: <span class="ruby-keyword kw">end</span>
207
- 275:
208
- 276: <span class="ruby-identifier">nargs</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">__urls__</span>[<span class="ruby-value">1</span>]
209
- 277: <span class="ruby-identifier">regexp</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>( <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">__urls__</span>[<span class="ruby-value">0</span>][<span class="ruby-identifier">finalPath</span>] )
210
- 278: <span class="ruby-identifier">args</span> = <span class="ruby-identifier">regexp</span>.<span class="ruby-identifier">match</span>( <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span>.<span class="ruby-identifier">unescape</span>(<span class="ruby-ivar">@request</span>.<span class="ruby-identifier">path</span>).<span class="ruby-identifier">gsub</span>( <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>( <span class="ruby-node">&quot;^#{finalPath}&quot;</span> ), <span class="ruby-value str">&quot;&quot;</span> ).<span class="ruby-identifier">gsub</span>( <span class="ruby-regexp re">/^\//</span>, <span class="ruby-value str">&quot;&quot;</span> ) )
211
- 279: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">nil?</span>
212
- 280: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">ParameterError</span>, <span class="ruby-node">&quot;Path info `#{@request.path_info}' does not match route regexp `#{regexp.source}'&quot;</span>
213
- 281: <span class="ruby-keyword kw">else</span>
214
- 282: <span class="ruby-identifier">args</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">captures</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> (<span class="ruby-identifier">x</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>)<span class="ruby-operator">?</span><span class="ruby-keyword kw">nil</span><span class="ruby-operator">:</span><span class="ruby-identifier">x</span> }
215
- 283: <span class="ruby-keyword kw">end</span>
216
- 284:
217
- 285: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">nargs</span>
218
- 286: <span class="ruby-identifier">args</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">nil</span>
219
- 287: <span class="ruby-keyword kw">end</span>
220
- 288:
221
- 289: <span class="ruby-identifier">get</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">args</span> )
222
- 290: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;POST&quot;</span>
223
- 291: <span class="ruby-identifier">post</span>
224
- 292: <span class="ruby-keyword kw">end</span>
225
- 293: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_ary</span>)
226
- 294: <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">status</span> = <span class="ruby-identifier">r</span>[<span class="ruby-value">0</span>]
227
- 295: <span class="ruby-identifier">r</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
228
- 296: <span class="ruby-ivar">@response</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
229
- 297: <span class="ruby-keyword kw">end</span>
230
- 298: <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">body</span> = <span class="ruby-identifier">r</span>[<span class="ruby-value">2</span>]
231
- 299: <span class="ruby-keyword kw">else</span>
232
- 300: <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">r</span>
233
- 301: <span class="ruby-keyword kw">end</span>
234
- 302:
235
- 303: <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">finish</span>
236
- 304: <span class="ruby-keyword kw">end</span>
237
- 305:
238
- 306: <span class="ruby-identifier">include</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">Helpers</span>
239
- 307: <span class="ruby-identifier">include</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">Views</span>
240
- 308: }
241
- 309: <span class="ruby-keyword kw">end</span>
133
+ <span class="ruby-comment cmt"># File lib/capcode.rb, line 240</span>
134
+ 240: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Route</span> <span class="ruby-operator">*</span><span class="ruby-identifier">u</span>
135
+ 241: <span class="ruby-constant">Class</span>.<span class="ruby-identifier">new</span> {
136
+ 242: <span class="ruby-identifier">meta_def</span>(<span class="ruby-identifier">:__urls__</span>){
137
+ 243: <span class="ruby-comment cmt"># &lt; Route '/hello/world/([^\/]*)/id(\d*)', '/hello/(.*)'</span>
138
+ 244: <span class="ruby-comment cmt"># # =&gt; [ {'/hello/world' =&gt; '([^\/]*)/id(\d*)', '/hello' =&gt; '(.*)'}, 2, &lt;Capcode::Klass&gt; ]</span>
139
+ 245: <span class="ruby-identifier">h</span> = {}
140
+ 246: <span class="ruby-identifier">max</span> = <span class="ruby-value">0</span>
141
+ 247: <span class="ruby-identifier">u</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">_u</span><span class="ruby-operator">|</span>
142
+ 248: <span class="ruby-identifier">m</span> = <span class="ruby-regexp re">/\/([^\/]*\(.*)/</span>.<span class="ruby-identifier">match</span>( <span class="ruby-identifier">_u</span> )
143
+ 249: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">nil?</span>
144
+ 250: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">RouteError</span>, <span class="ruby-node">&quot;Route `#{_u}' already defined with regexp `#{h[_u]}' !&quot;</span>, <span class="ruby-identifier">caller</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">h</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">_u</span>)
145
+ 251: <span class="ruby-identifier">h</span>[<span class="ruby-identifier">_u</span>] = <span class="ruby-value str">''</span>
146
+ 252: <span class="ruby-keyword kw">else</span>
147
+ 253: <span class="ruby-identifier">_pre</span> = <span class="ruby-identifier">m</span>.<span class="ruby-identifier">pre_match</span>
148
+ 254: <span class="ruby-identifier">_pre</span> = <span class="ruby-value str">&quot;/&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">_pre</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
149
+ 255: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">RouteError</span>, <span class="ruby-node">&quot;Route `#{_pre}' already defined with regexp `#{h[_pre]}' !&quot;</span>, <span class="ruby-identifier">caller</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">h</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">_pre</span>)
150
+ 256: <span class="ruby-identifier">h</span>[<span class="ruby-identifier">_pre</span>] = <span class="ruby-identifier">m</span>.<span class="ruby-identifier">captures</span>[<span class="ruby-value">0</span>]
151
+ 257: <span class="ruby-identifier">max</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">m</span>.<span class="ruby-identifier">captures</span>[<span class="ruby-value">0</span>]).<span class="ruby-identifier">number_of_captures</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">max</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">m</span>.<span class="ruby-identifier">captures</span>[<span class="ruby-value">0</span>]).<span class="ruby-identifier">number_of_captures</span>
152
+ 258: <span class="ruby-keyword kw">end</span>
153
+ 259: <span class="ruby-keyword kw">end</span>
154
+ 260: [<span class="ruby-identifier">h</span>, <span class="ruby-identifier">max</span>, <span class="ruby-keyword kw">self</span>]
155
+ 261: }
156
+ 262:
157
+ 263: <span class="ruby-comment cmt"># Hash containing all the request parameters (GET or POST)</span>
158
+ 264: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">params</span>
159
+ 265: <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">params</span>
160
+ 266: <span class="ruby-keyword kw">end</span>
161
+ 267:
162
+ 268: <span class="ruby-comment cmt"># Hash containing all the environment variables</span>
163
+ 269: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">env</span>
164
+ 270: <span class="ruby-ivar">@env</span>
165
+ 271: <span class="ruby-keyword kw">end</span>
166
+ 272:
167
+ 273: <span class="ruby-comment cmt"># Hash session</span>
168
+ 274: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">session</span>
169
+ 275: <span class="ruby-ivar">@env</span>[<span class="ruby-value str">'rack.session'</span>]
170
+ 276: <span class="ruby-keyword kw">end</span>
171
+ 277:
172
+ 278: <span class="ruby-comment cmt"># Return the Rack::Request object</span>
173
+ 279: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">request</span>
174
+ 280: <span class="ruby-ivar">@request</span>
175
+ 281: <span class="ruby-keyword kw">end</span>
176
+ 282:
177
+ 283: <span class="ruby-comment cmt"># Return the Rack::Response object</span>
178
+ 284: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">response</span>
179
+ 285: <span class="ruby-ivar">@response</span>
180
+ 286: <span class="ruby-keyword kw">end</span>
181
+ 287:
182
+ 288: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>( <span class="ruby-identifier">e</span> ) <span class="ruby-comment cmt">#:nodoc:</span>
183
+ 289: <span class="ruby-ivar">@env</span> = <span class="ruby-identifier">e</span>
184
+ 290: <span class="ruby-ivar">@response</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Response</span>.<span class="ruby-identifier">new</span>
185
+ 291: <span class="ruby-ivar">@request</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@env</span>)
186
+ 292:
187
+ 293: <span class="ruby-identifier">r</span> = <span class="ruby-keyword kw">case</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value str">&quot;REQUEST_METHOD&quot;</span>]
188
+ 294: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;GET&quot;</span>
189
+ 295: <span class="ruby-identifier">finalPath</span> = <span class="ruby-keyword kw">nil</span>
190
+ 296: <span class="ruby-identifier">finalArgs</span> = <span class="ruby-keyword kw">nil</span>
191
+ 297: <span class="ruby-identifier">finalNArgs</span> = <span class="ruby-keyword kw">nil</span>
192
+ 298:
193
+ 299: <span class="ruby-identifier">aPath</span> = <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">gsub</span>( <span class="ruby-regexp re">/^\//</span>, <span class="ruby-value str">&quot;&quot;</span> ).<span class="ruby-identifier">split</span>( <span class="ruby-value str">&quot;/&quot;</span> )
194
+ 300: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">__urls__</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span>, <span class="ruby-identifier">r</span><span class="ruby-operator">|</span>
195
+ 301: <span class="ruby-identifier">xPath</span> = <span class="ruby-identifier">p</span>.<span class="ruby-identifier">gsub</span>( <span class="ruby-regexp re">/^\//</span>, <span class="ruby-value str">&quot;&quot;</span> ).<span class="ruby-identifier">split</span>( <span class="ruby-value str">&quot;/&quot;</span> )
196
+ 302: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">xPath</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">aPath</span>).<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
197
+ 303: <span class="ruby-identifier">diffArgs</span> = <span class="ruby-identifier">aPath</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">xPath</span>
198
+ 304: <span class="ruby-identifier">diffNArgs</span> = <span class="ruby-identifier">diffArgs</span>.<span class="ruby-identifier">size</span>
199
+ 305: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">finalNArgs</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">finalNArgs</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">diffNArgs</span>
200
+ 306: <span class="ruby-identifier">finalPath</span> = <span class="ruby-identifier">p</span>
201
+ 307: <span class="ruby-identifier">finalNArgs</span> = <span class="ruby-identifier">diffNArgs</span>
202
+ 308: <span class="ruby-identifier">finalArgs</span> = <span class="ruby-identifier">diffArgs</span>
203
+ 309: <span class="ruby-keyword kw">end</span>
204
+ 310: <span class="ruby-keyword kw">end</span>
205
+ 311:
206
+ 312: <span class="ruby-keyword kw">end</span>
207
+ 313:
208
+ 314: <span class="ruby-identifier">nargs</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">__urls__</span>[<span class="ruby-value">1</span>]
209
+ 315: <span class="ruby-identifier">regexp</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>( <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">__urls__</span>[<span class="ruby-value">0</span>][<span class="ruby-identifier">finalPath</span>] )
210
+ 316: <span class="ruby-identifier">args</span> = <span class="ruby-identifier">regexp</span>.<span class="ruby-identifier">match</span>( <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span>.<span class="ruby-identifier">unescape</span>(<span class="ruby-ivar">@request</span>.<span class="ruby-identifier">path</span>).<span class="ruby-identifier">gsub</span>( <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>( <span class="ruby-node">&quot;^#{finalPath}&quot;</span> ), <span class="ruby-value str">&quot;&quot;</span> ).<span class="ruby-identifier">gsub</span>( <span class="ruby-regexp re">/^\//</span>, <span class="ruby-value str">&quot;&quot;</span> ) )
211
+ 317: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">nil?</span>
212
+ 318: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">ParameterError</span>, <span class="ruby-node">&quot;Path info `#{@request.path_info}' does not match route regexp `#{regexp.source}'&quot;</span>
213
+ 319: <span class="ruby-keyword kw">else</span>
214
+ 320: <span class="ruby-identifier">args</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">captures</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> (<span class="ruby-identifier">x</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>)<span class="ruby-operator">?</span><span class="ruby-keyword kw">nil</span><span class="ruby-operator">:</span><span class="ruby-identifier">x</span> }
215
+ 321: <span class="ruby-keyword kw">end</span>
216
+ 322:
217
+ 323: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">nargs</span>
218
+ 324: <span class="ruby-identifier">args</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">nil</span>
219
+ 325: <span class="ruby-keyword kw">end</span>
220
+ 326:
221
+ 327: <span class="ruby-identifier">get</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">args</span> )
222
+ 328: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;POST&quot;</span>
223
+ 329: <span class="ruby-identifier">post</span>
224
+ 330: <span class="ruby-keyword kw">end</span>
225
+ 331: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_ary</span>)
226
+ 332: <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">status</span> = <span class="ruby-identifier">r</span>[<span class="ruby-value">0</span>]
227
+ 333: <span class="ruby-identifier">r</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
228
+ 334: <span class="ruby-ivar">@response</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
229
+ 335: <span class="ruby-keyword kw">end</span>
230
+ 336: <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">body</span> = <span class="ruby-identifier">r</span>[<span class="ruby-value">2</span>]
231
+ 337: <span class="ruby-keyword kw">else</span>
232
+ 338: <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">r</span>
233
+ 339: <span class="ruby-keyword kw">end</span>
234
+ 340:
235
+ 341: <span class="ruby-ivar">@response</span>.<span class="ruby-identifier">finish</span>
236
+ 342: <span class="ruby-keyword kw">end</span>
237
+ 343:
238
+ 344: <span class="ruby-identifier">include</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">Helpers</span>
239
+ 345: <span class="ruby-identifier">include</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">Views</span>
240
+ 346: }
241
+ 347: <span class="ruby-keyword kw">end</span>
242
242
  </pre>
243
243
  </div>
244
244
  </div>
@@ -253,10 +253,10 @@ Hash containing all the environment variables
253
253
  <p class="source-link">[ <a href="javascript:toggleSource('M000003_source')" id="l_M000003_source">show source</a> ]</p>
254
254
  <div id="M000003_source" class="dyn-source">
255
255
  <pre>
256
- <span class="ruby-comment cmt"># File lib/capcode.rb, line 231</span>
257
- 231: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">env</span>
258
- 232: <span class="ruby-ivar">@env</span>
259
- 233: <span class="ruby-keyword kw">end</span>
256
+ <span class="ruby-comment cmt"># File lib/capcode.rb, line 269</span>
257
+ 269: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">env</span>
258
+ 270: <span class="ruby-ivar">@env</span>
259
+ 271: <span class="ruby-keyword kw">end</span>
260
260
  </pre>
261
261
  </div>
262
262
  </div>
@@ -277,10 +277,10 @@ Rack or What you want Helper
277
277
  <p class="source-link">[ <a href="javascript:toggleSource('M000007_source')" id="l_M000007_source">show source</a> ]</p>
278
278
  <div id="M000007_source" class="dyn-source">
279
279
  <pre>
280
- <span class="ruby-comment cmt"># File lib/capcode.rb, line 316</span>
281
- 316: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">map</span>( <span class="ruby-identifier">r</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span> )
282
- 317: <span class="ruby-ivar">@@__ROUTES</span>[<span class="ruby-identifier">r</span>] = <span class="ruby-keyword kw">yield</span>
283
- 318: <span class="ruby-keyword kw">end</span>
280
+ <span class="ruby-comment cmt"># File lib/capcode.rb, line 354</span>
281
+ 354: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">map</span>( <span class="ruby-identifier">r</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span> )
282
+ 355: <span class="ruby-ivar">@@__ROUTES</span>[<span class="ruby-identifier">r</span>] = <span class="ruby-keyword kw">yield</span>
283
+ 356: <span class="ruby-keyword kw">end</span>
284
284
  </pre>
285
285
  </div>
286
286
  </div>
@@ -296,10 +296,10 @@ parameters (GET or POST)
296
296
  <p class="source-link">[ <a href="javascript:toggleSource('M000002_source')" id="l_M000002_source">show source</a> ]</p>
297
297
  <div id="M000002_source" class="dyn-source">
298
298
  <pre>
299
- <span class="ruby-comment cmt"># File lib/capcode.rb, line 226</span>
300
- 226: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">params</span>
301
- 227: <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">params</span>
302
- 228: <span class="ruby-keyword kw">end</span>
299
+ <span class="ruby-comment cmt"># File lib/capcode.rb, line 264</span>
300
+ 264: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">params</span>
301
+ 265: <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">params</span>
302
+ 266: <span class="ruby-keyword kw">end</span>
303
303
  </pre>
304
304
  </div>
305
305
  </div>
@@ -314,10 +314,10 @@ Return the Rack::Request object
314
314
  <p class="source-link">[ <a href="javascript:toggleSource('M000005_source')" id="l_M000005_source">show source</a> ]</p>
315
315
  <div id="M000005_source" class="dyn-source">
316
316
  <pre>
317
- <span class="ruby-comment cmt"># File lib/capcode.rb, line 241</span>
318
- 241: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">request</span>
319
- 242: <span class="ruby-ivar">@request</span>
320
- 243: <span class="ruby-keyword kw">end</span>
317
+ <span class="ruby-comment cmt"># File lib/capcode.rb, line 279</span>
318
+ 279: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">request</span>
319
+ 280: <span class="ruby-ivar">@request</span>
320
+ 281: <span class="ruby-keyword kw">end</span>
321
321
  </pre>
322
322
  </div>
323
323
  </div>
@@ -332,10 +332,10 @@ Return the Rack::Response object
332
332
  <p class="source-link">[ <a href="javascript:toggleSource('M000006_source')" id="l_M000006_source">show source</a> ]</p>
333
333
  <div id="M000006_source" class="dyn-source">
334
334
  <pre>
335
- <span class="ruby-comment cmt"># File lib/capcode.rb, line 246</span>
336
- 246: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">response</span>
337
- 247: <span class="ruby-ivar">@response</span>
338
- 248: <span class="ruby-keyword kw">end</span>
335
+ <span class="ruby-comment cmt"># File lib/capcode.rb, line 284</span>
336
+ 284: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">response</span>
337
+ 285: <span class="ruby-ivar">@response</span>
338
+ 286: <span class="ruby-keyword kw">end</span>
339
339
  </pre>
340
340
  </div>
341
341
  </div>
@@ -388,99 +388,99 @@ main.rb)
388
388
  <p class="source-link">[ <a href="javascript:toggleSource('M000008_source')" id="l_M000008_source">show source</a> ]</p>
389
389
  <div id="M000008_source" class="dyn-source">
390
390
  <pre>
391
- <span class="ruby-comment cmt"># File lib/capcode.rb, line 333</span>
392
- 333: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>( <span class="ruby-identifier">args</span> = {} )
393
- 334: <span class="ruby-identifier">conf</span> = {
394
- 335: <span class="ruby-identifier">:port</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:port</span>]<span class="ruby-operator">||</span><span class="ruby-value">3000</span>,
395
- 336: <span class="ruby-identifier">:host</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:host</span>]<span class="ruby-operator">||</span><span class="ruby-value str">&quot;localhost&quot;</span>,
396
- 337: <span class="ruby-identifier">:server</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:server</span>]<span class="ruby-operator">||</span><span class="ruby-keyword kw">nil</span>,
397
- 338: <span class="ruby-identifier">:log</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:log</span>]<span class="ruby-operator">||</span><span class="ruby-identifier">$stdout</span>,
398
- 339: <span class="ruby-identifier">:session</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:session</span>]<span class="ruby-operator">||</span>{},
399
- 340: <span class="ruby-identifier">:pid</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:pid</span>]<span class="ruby-operator">||</span><span class="ruby-node">&quot;#{$0}.pid&quot;</span>,
400
- 341: <span class="ruby-identifier">:daemonize</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:daemonize</span>]<span class="ruby-operator">||</span><span class="ruby-keyword kw">false</span>,
401
- 342: <span class="ruby-identifier">:db_config</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:db_config</span>]<span class="ruby-operator">||</span><span class="ruby-value str">&quot;database.yml&quot;</span>,
402
- 343: <span class="ruby-identifier">:root</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:root</span>]<span class="ruby-operator">||</span><span class="ruby-value str">&quot;.&quot;</span>,
403
- 344: <span class="ruby-identifier">:working_directory</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:working_directory</span>]<span class="ruby-operator">||</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">$0</span>))
404
- 345: }
405
- 346:
406
- 347: <span class="ruby-comment cmt"># Run in the Working directory</span>
407
- 348: <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">chdir</span>( <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:working_directory</span>] ) <span class="ruby-keyword kw">do</span>
408
- 349: <span class="ruby-comment cmt"># Set root directory for helpers</span>
409
- 350: <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">Helpers</span>.<span class="ruby-identifier">root</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>( <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:root</span>] )
410
- 351:
411
- 352: <span class="ruby-comment cmt"># Check that mongrel exists </span>
412
- 353: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:server</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:server</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;mongrel&quot;</span>
413
- 354: <span class="ruby-keyword kw">begin</span>
414
- 355: <span class="ruby-identifier">require</span> <span class="ruby-value str">'mongrel'</span>
415
- 356: <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:server</span>] = <span class="ruby-value str">&quot;mongrel&quot;</span>
416
- 357: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">LoadError</span>
417
- 358: <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;!! could not load mongrel. Falling back to webrick.&quot;</span>
418
- 359: <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:server</span>] = <span class="ruby-value str">&quot;webrick&quot;</span>
419
- 360: <span class="ruby-keyword kw">end</span>
420
- 361: <span class="ruby-keyword kw">end</span>
421
- 362:
422
- 363: <span class="ruby-constant">Capcode</span>.<span class="ruby-identifier">constants</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span>
423
- 364: <span class="ruby-keyword kw">begin</span>
424
- 365: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">eval</span> <span class="ruby-node">&quot;Capcode::#{k}.public_methods(true).include?( '__urls__' )&quot;</span>
425
- 366: <span class="ruby-identifier">u</span>, <span class="ruby-identifier">m</span>, <span class="ruby-identifier">c</span> = <span class="ruby-identifier">eval</span> <span class="ruby-node">&quot;Capcode::#{k}.__urls__&quot;</span>
426
- 367: <span class="ruby-identifier">u</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">_u</span><span class="ruby-operator">|</span>
427
- 368: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">RouteError</span>, <span class="ruby-node">&quot;Route `#{_u}' already define !&quot;</span>, <span class="ruby-identifier">caller</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@@__ROUTES</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">_u</span>)
428
- 369: <span class="ruby-ivar">@@__ROUTES</span>[<span class="ruby-identifier">_u</span>] = <span class="ruby-identifier">c</span>.<span class="ruby-identifier">new</span>
429
- 370: <span class="ruby-keyword kw">end</span>
430
- 371: <span class="ruby-keyword kw">end</span>
431
- 372: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
432
- 373: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>
433
- 374: <span class="ruby-keyword kw">end</span>
434
- 375: <span class="ruby-keyword kw">end</span>
435
- 376:
436
- 377: <span class="ruby-identifier">app</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">URLMap</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@@__ROUTES</span>)
437
- 378: <span class="ruby-identifier">app</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Session</span><span class="ruby-operator">::</span><span class="ruby-constant">Cookie</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">app</span>, <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:session</span>] )
438
- 379: <span class="ruby-identifier">app</span> = <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTPError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">app</span>, <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:root</span>])
439
- 380: <span class="ruby-identifier">app</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">ContentLength</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">app</span>)
440
- 381: <span class="ruby-identifier">app</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Lint</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">app</span>)
441
- 382: <span class="ruby-identifier">app</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">ShowExceptions</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">app</span>)
442
- 383: <span class="ruby-comment cmt"># app = Rack::Reloader.new(app) ## -- NE RELOAD QUE capcode.rb -- So !!!</span>
443
- 384: <span class="ruby-identifier">app</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">CommonLogger</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">app</span>, <span class="ruby-constant">Logger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:log</span>]) )
444
- 385:
445
- 386: <span class="ruby-comment cmt"># From rackup !!!</span>
446
- 387: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:daemonize</span>]
447
- 388: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">RUBY_VERSION</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value str">&quot;1.9&quot;</span>
448
- 389: <span class="ruby-identifier">exit</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fork</span>
449
- 390: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">setsid</span>
450
- 391: <span class="ruby-identifier">exit</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fork</span>
451
- 392: <span class="ruby-comment cmt"># Dir.chdir &quot;/&quot;</span>
452
- 393: <span class="ruby-constant">File</span>.<span class="ruby-identifier">umask</span> <span class="ruby-value">0000</span>
453
- 394: <span class="ruby-constant">STDIN</span>.<span class="ruby-identifier">reopen</span> <span class="ruby-value str">&quot;/dev/null&quot;</span>
454
- 395: <span class="ruby-constant">STDOUT</span>.<span class="ruby-identifier">reopen</span> <span class="ruby-value str">&quot;/dev/null&quot;</span>, <span class="ruby-value str">&quot;a&quot;</span>
455
- 396: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">reopen</span> <span class="ruby-value str">&quot;/dev/null&quot;</span>, <span class="ruby-value str">&quot;a&quot;</span>
456
- 397: <span class="ruby-keyword kw">else</span>
457
- 398: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">daemon</span>
458
- 399: <span class="ruby-keyword kw">end</span>
459
- 400:
460
- 401: <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:pid</span>], <span class="ruby-value str">'w'</span>){ <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span>(<span class="ruby-node">&quot;#{Process.pid}&quot;</span>) }
461
- 402: <span class="ruby-identifier">at_exit</span> { <span class="ruby-constant">File</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:pid</span>]) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:pid</span>]) }
462
- 403: <span class="ruby-keyword kw">end</span>
463
- 404:
464
- 405: <span class="ruby-comment cmt"># Start database</span>
465
- 406: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">methods</span>.<span class="ruby-identifier">include?</span> <span class="ruby-value str">&quot;db_connect&quot;</span>
466
- 407: <span class="ruby-identifier">db_connect</span>( <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:db_config</span>], <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:log</span>] )
467
- 408: <span class="ruby-keyword kw">end</span>
468
- 409:
469
- 410: <span class="ruby-comment cmt"># Start server</span>
470
- 411: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:server</span>]
471
- 412: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;mongrel&quot;</span>
472
- 413: <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;** Starting Mongrel on #{conf[:host]}:#{conf[:port]}&quot;</span>
473
- 414: <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Handler</span><span class="ruby-operator">::</span><span class="ruby-constant">Mongrel</span>.<span class="ruby-identifier">run</span>( <span class="ruby-identifier">app</span>, {<span class="ruby-identifier">:Port</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:port</span>], <span class="ruby-identifier">:Host</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:host</span>]} ) { <span class="ruby-operator">|</span><span class="ruby-identifier">server</span><span class="ruby-operator">|</span>
474
- 415: <span class="ruby-identifier">trap</span> <span class="ruby-value str">&quot;SIGINT&quot;</span>, <span class="ruby-identifier">proc</span> { <span class="ruby-identifier">server</span>.<span class="ruby-identifier">stop</span> }
475
- 416: }
476
- 417: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;webrick&quot;</span>
477
- 418: <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;** Starting WEBrick on #{conf[:host]}:#{conf[:port]}&quot;</span>
478
- 419: <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Handler</span><span class="ruby-operator">::</span><span class="ruby-constant">WEBrick</span>.<span class="ruby-identifier">run</span>( <span class="ruby-identifier">app</span>, {<span class="ruby-identifier">:Port</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:port</span>], <span class="ruby-identifier">:BindAddress</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:host</span>]} ) { <span class="ruby-operator">|</span><span class="ruby-identifier">server</span><span class="ruby-operator">|</span>
479
- 420: <span class="ruby-identifier">trap</span> <span class="ruby-value str">&quot;SIGINT&quot;</span>, <span class="ruby-identifier">proc</span> { <span class="ruby-identifier">server</span>.<span class="ruby-identifier">shutdown</span> }
480
- 421: }
481
- 422: <span class="ruby-keyword kw">end</span>
482
- 423: <span class="ruby-keyword kw">end</span>
483
- 424: <span class="ruby-keyword kw">end</span>
391
+ <span class="ruby-comment cmt"># File lib/capcode.rb, line 371</span>
392
+ 371: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>( <span class="ruby-identifier">args</span> = {} )
393
+ 372: <span class="ruby-identifier">conf</span> = {
394
+ 373: <span class="ruby-identifier">:port</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:port</span>]<span class="ruby-operator">||</span><span class="ruby-value">3000</span>,
395
+ 374: <span class="ruby-identifier">:host</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:host</span>]<span class="ruby-operator">||</span><span class="ruby-value str">&quot;localhost&quot;</span>,
396
+ 375: <span class="ruby-identifier">:server</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:server</span>]<span class="ruby-operator">||</span><span class="ruby-keyword kw">nil</span>,
397
+ 376: <span class="ruby-identifier">:log</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:log</span>]<span class="ruby-operator">||</span><span class="ruby-identifier">$stdout</span>,
398
+ 377: <span class="ruby-identifier">:session</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:session</span>]<span class="ruby-operator">||</span>{},
399
+ 378: <span class="ruby-identifier">:pid</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:pid</span>]<span class="ruby-operator">||</span><span class="ruby-node">&quot;#{$0}.pid&quot;</span>,
400
+ 379: <span class="ruby-identifier">:daemonize</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:daemonize</span>]<span class="ruby-operator">||</span><span class="ruby-keyword kw">false</span>,
401
+ 380: <span class="ruby-identifier">:db_config</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:db_config</span>]<span class="ruby-operator">||</span><span class="ruby-value str">&quot;database.yml&quot;</span>,
402
+ 381: <span class="ruby-identifier">:root</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:root</span>]<span class="ruby-operator">||</span><span class="ruby-value str">&quot;.&quot;</span>,
403
+ 382: <span class="ruby-identifier">:working_directory</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:working_directory</span>]<span class="ruby-operator">||</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">$0</span>))
404
+ 383: }
405
+ 384:
406
+ 385: <span class="ruby-comment cmt"># Run in the Working directory</span>
407
+ 386: <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">chdir</span>( <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:working_directory</span>] ) <span class="ruby-keyword kw">do</span>
408
+ 387: <span class="ruby-comment cmt"># Set root directory for helpers</span>
409
+ 388: <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">Helpers</span>.<span class="ruby-identifier">root</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>( <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:root</span>] )
410
+ 389:
411
+ 390: <span class="ruby-comment cmt"># Check that mongrel exists </span>
412
+ 391: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:server</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:server</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;mongrel&quot;</span>
413
+ 392: <span class="ruby-keyword kw">begin</span>
414
+ 393: <span class="ruby-identifier">require</span> <span class="ruby-value str">'mongrel'</span>
415
+ 394: <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:server</span>] = <span class="ruby-value str">&quot;mongrel&quot;</span>
416
+ 395: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">LoadError</span>
417
+ 396: <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;!! could not load mongrel. Falling back to webrick.&quot;</span>
418
+ 397: <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:server</span>] = <span class="ruby-value str">&quot;webrick&quot;</span>
419
+ 398: <span class="ruby-keyword kw">end</span>
420
+ 399: <span class="ruby-keyword kw">end</span>
421
+ 400:
422
+ 401: <span class="ruby-constant">Capcode</span>.<span class="ruby-identifier">constants</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span>
423
+ 402: <span class="ruby-keyword kw">begin</span>
424
+ 403: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">eval</span> <span class="ruby-node">&quot;Capcode::#{k}.public_methods(true).include?( '__urls__' )&quot;</span>
425
+ 404: <span class="ruby-identifier">u</span>, <span class="ruby-identifier">m</span>, <span class="ruby-identifier">c</span> = <span class="ruby-identifier">eval</span> <span class="ruby-node">&quot;Capcode::#{k}.__urls__&quot;</span>
426
+ 405: <span class="ruby-identifier">u</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">_u</span><span class="ruby-operator">|</span>
427
+ 406: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">RouteError</span>, <span class="ruby-node">&quot;Route `#{_u}' already define !&quot;</span>, <span class="ruby-identifier">caller</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@@__ROUTES</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">_u</span>)
428
+ 407: <span class="ruby-ivar">@@__ROUTES</span>[<span class="ruby-identifier">_u</span>] = <span class="ruby-identifier">c</span>.<span class="ruby-identifier">new</span>
429
+ 408: <span class="ruby-keyword kw">end</span>
430
+ 409: <span class="ruby-keyword kw">end</span>
431
+ 410: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
432
+ 411: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>
433
+ 412: <span class="ruby-keyword kw">end</span>
434
+ 413: <span class="ruby-keyword kw">end</span>
435
+ 414:
436
+ 415: <span class="ruby-identifier">app</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">URLMap</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@@__ROUTES</span>)
437
+ 416: <span class="ruby-identifier">app</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Session</span><span class="ruby-operator">::</span><span class="ruby-constant">Cookie</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">app</span>, <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:session</span>] )
438
+ 417: <span class="ruby-identifier">app</span> = <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTPError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">app</span>, <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:root</span>])
439
+ 418: <span class="ruby-identifier">app</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">ContentLength</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">app</span>)
440
+ 419: <span class="ruby-identifier">app</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Lint</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">app</span>)
441
+ 420: <span class="ruby-identifier">app</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">ShowExceptions</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">app</span>)
442
+ 421: <span class="ruby-comment cmt"># app = Rack::Reloader.new(app) ## -- NE RELOAD QUE capcode.rb -- So !!!</span>
443
+ 422: <span class="ruby-identifier">app</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">CommonLogger</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">app</span>, <span class="ruby-constant">Logger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:log</span>]) )
444
+ 423:
445
+ 424: <span class="ruby-comment cmt"># From rackup !!!</span>
446
+ 425: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:daemonize</span>]
447
+ 426: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">RUBY_VERSION</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value str">&quot;1.9&quot;</span>
448
+ 427: <span class="ruby-identifier">exit</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fork</span>
449
+ 428: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">setsid</span>
450
+ 429: <span class="ruby-identifier">exit</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fork</span>
451
+ 430: <span class="ruby-comment cmt"># Dir.chdir &quot;/&quot;</span>
452
+ 431: <span class="ruby-constant">File</span>.<span class="ruby-identifier">umask</span> <span class="ruby-value">0000</span>
453
+ 432: <span class="ruby-constant">STDIN</span>.<span class="ruby-identifier">reopen</span> <span class="ruby-value str">&quot;/dev/null&quot;</span>
454
+ 433: <span class="ruby-constant">STDOUT</span>.<span class="ruby-identifier">reopen</span> <span class="ruby-value str">&quot;/dev/null&quot;</span>, <span class="ruby-value str">&quot;a&quot;</span>
455
+ 434: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">reopen</span> <span class="ruby-value str">&quot;/dev/null&quot;</span>, <span class="ruby-value str">&quot;a&quot;</span>
456
+ 435: <span class="ruby-keyword kw">else</span>
457
+ 436: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">daemon</span>
458
+ 437: <span class="ruby-keyword kw">end</span>
459
+ 438:
460
+ 439: <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:pid</span>], <span class="ruby-value str">'w'</span>){ <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span>(<span class="ruby-node">&quot;#{Process.pid}&quot;</span>) }
461
+ 440: <span class="ruby-identifier">at_exit</span> { <span class="ruby-constant">File</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:pid</span>]) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:pid</span>]) }
462
+ 441: <span class="ruby-keyword kw">end</span>
463
+ 442:
464
+ 443: <span class="ruby-comment cmt"># Start database</span>
465
+ 444: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">methods</span>.<span class="ruby-identifier">include?</span> <span class="ruby-value str">&quot;db_connect&quot;</span>
466
+ 445: <span class="ruby-identifier">db_connect</span>( <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:db_config</span>], <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:log</span>] )
467
+ 446: <span class="ruby-keyword kw">end</span>
468
+ 447:
469
+ 448: <span class="ruby-comment cmt"># Start server</span>
470
+ 449: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:server</span>]
471
+ 450: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;mongrel&quot;</span>
472
+ 451: <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;** Starting Mongrel on #{conf[:host]}:#{conf[:port]}&quot;</span>
473
+ 452: <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Handler</span><span class="ruby-operator">::</span><span class="ruby-constant">Mongrel</span>.<span class="ruby-identifier">run</span>( <span class="ruby-identifier">app</span>, {<span class="ruby-identifier">:Port</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:port</span>], <span class="ruby-identifier">:Host</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:host</span>]} ) { <span class="ruby-operator">|</span><span class="ruby-identifier">server</span><span class="ruby-operator">|</span>
474
+ 453: <span class="ruby-identifier">trap</span> <span class="ruby-value str">&quot;SIGINT&quot;</span>, <span class="ruby-identifier">proc</span> { <span class="ruby-identifier">server</span>.<span class="ruby-identifier">stop</span> }
475
+ 454: }
476
+ 455: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;webrick&quot;</span>
477
+ 456: <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;** Starting WEBrick on #{conf[:host]}:#{conf[:port]}&quot;</span>
478
+ 457: <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Handler</span><span class="ruby-operator">::</span><span class="ruby-constant">WEBrick</span>.<span class="ruby-identifier">run</span>( <span class="ruby-identifier">app</span>, {<span class="ruby-identifier">:Port</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:port</span>], <span class="ruby-identifier">:BindAddress</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">conf</span>[<span class="ruby-identifier">:host</span>]} ) { <span class="ruby-operator">|</span><span class="ruby-identifier">server</span><span class="ruby-operator">|</span>
479
+ 458: <span class="ruby-identifier">trap</span> <span class="ruby-value str">&quot;SIGINT&quot;</span>, <span class="ruby-identifier">proc</span> { <span class="ruby-identifier">server</span>.<span class="ruby-identifier">shutdown</span> }
480
+ 459: }
481
+ 460: <span class="ruby-keyword kw">end</span>
482
+ 461: <span class="ruby-keyword kw">end</span>
483
+ 462: <span class="ruby-keyword kw">end</span>
484
484
  </pre>
485
485
  </div>
486
486
  </div>
@@ -495,10 +495,10 @@ Hash <a href="Capcode.html#M000004">session</a>
495
495
  <p class="source-link">[ <a href="javascript:toggleSource('M000004_source')" id="l_M000004_source">show source</a> ]</p>
496
496
  <div id="M000004_source" class="dyn-source">
497
497
  <pre>
498
- <span class="ruby-comment cmt"># File lib/capcode.rb, line 236</span>
499
- 236: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">session</span>
500
- 237: <span class="ruby-ivar">@env</span>[<span class="ruby-value str">'rack.session'</span>]
501
- 238: <span class="ruby-keyword kw">end</span>
498
+ <span class="ruby-comment cmt"># File lib/capcode.rb, line 274</span>
499
+ 274: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">session</span>
500
+ 275: <span class="ruby-ivar">@env</span>[<span class="ruby-value str">'rack.session'</span>]
501
+ 276: <span class="ruby-keyword kw">end</span>
502
502
  </pre>
503
503
  </div>
504
504
  </div>