merb 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/README +22 -4
  2. data/Rakefile +15 -3
  3. data/TODO +2 -3
  4. data/bin/merb +61 -36
  5. data/examples/sample_app/dist/app/controllers/files.rb +31 -0
  6. data/examples/sample_app/dist/app/controllers/posts.rb +26 -2
  7. data/examples/sample_app/dist/app/controllers/test.rb +7 -1
  8. data/examples/sample_app/dist/app/views/files/progress.jerb +3 -0
  9. data/examples/sample_app/dist/app/views/files/start.herb +62 -0
  10. data/examples/sample_app/dist/app/views/files/upload.herb +6 -0
  11. data/examples/sample_app/dist/app/views/layout/{application.rhtml → application.herb} +2 -3
  12. data/examples/sample_app/dist/app/views/layout/{foo.rhtml → foo.herb} +0 -0
  13. data/examples/sample_app/dist/app/views/posts/{_comments.rhtml → _comments.herb} +0 -0
  14. data/examples/sample_app/dist/app/views/posts/comment.jerb +1 -0
  15. data/examples/sample_app/dist/app/views/posts/{list.rhtml → list.herb} +0 -0
  16. data/examples/sample_app/dist/app/views/posts/{new.rhtml → new.herb} +0 -0
  17. data/examples/sample_app/dist/app/views/posts/{show.rhtml → show.herb} +0 -0
  18. data/examples/sample_app/dist/app/views/posts/xml_test.xerb +3 -0
  19. data/examples/sample_app/dist/app/views/test/{foo.rhtml → foo.herb} +0 -0
  20. data/examples/sample_app/dist/app/views/test/{hello.rhtml → hello.herb} +0 -0
  21. data/examples/sample_app/dist/app/views/test/json.jerb +1 -0
  22. data/examples/sample_app/dist/conf/merb.yml +11 -0
  23. data/examples/sample_app/dist/conf/merb_init.rb +1 -1
  24. data/examples/sample_app/dist/conf/mup.conf +11 -0
  25. data/examples/sample_app/dist/public/javascripts/mup.js +113 -0
  26. data/examples/sample_app/script/merb_stop +7 -3
  27. data/examples/sample_app/script/startdrb +8 -0
  28. data/lib/merb.rb +37 -2
  29. data/lib/merb/merb_class_extensions.rb +21 -22
  30. data/lib/merb/merb_controller.rb +101 -33
  31. data/lib/merb/merb_handler.rb +26 -25
  32. data/lib/merb/merb_router.rb +1 -1
  33. data/lib/merb/merb_utils.rb +35 -37
  34. data/lib/merb/mixins/basic_authentication_mixin.rb +39 -0
  35. data/lib/merb/mixins/controller_mixin.rb +119 -115
  36. data/lib/merb/mixins/javascript_mixin.rb +63 -0
  37. data/lib/merb/mixins/render_mixin.rb +85 -69
  38. data/lib/merb/mixins/responder_mixin.rb +38 -0
  39. data/lib/merb/session/merb_drb_server.rb +107 -0
  40. data/lib/merb/session/merb_drb_session.rb +71 -0
  41. data/lib/merb/session/merb_session.rb +1 -0
  42. data/lib/merb/vendor/paginator/README.txt +84 -0
  43. data/lib/merb/vendor/paginator/paginator.rb +121 -0
  44. data/lib/mutex_hotfix.rb +34 -0
  45. metadata +41 -63
  46. data/doc/rdoc/classes/ControllerMixin.html +0 -676
  47. data/doc/rdoc/classes/Hash.html +0 -148
  48. data/doc/rdoc/classes/Merb.html +0 -140
  49. data/doc/rdoc/classes/Merb/Controller.html +0 -338
  50. data/doc/rdoc/classes/Merb/RouteMatcher.html +0 -388
  51. data/doc/rdoc/classes/Merb/Server.html +0 -148
  52. data/doc/rdoc/classes/Merb/Session.html +0 -201
  53. data/doc/rdoc/classes/Merb/SessionMixin.html +0 -199
  54. data/doc/rdoc/classes/MerbControllerError.html +0 -111
  55. data/doc/rdoc/classes/MerbHandler.html +0 -430
  56. data/doc/rdoc/classes/MerbHash.html +0 -469
  57. data/doc/rdoc/classes/MerbHash/Mutex.html +0 -198
  58. data/doc/rdoc/classes/Noroutefound.html +0 -153
  59. data/doc/rdoc/classes/Object.html +0 -149
  60. data/doc/rdoc/classes/RenderMixin.html +0 -362
  61. data/doc/rdoc/classes/String.html +0 -212
  62. data/doc/rdoc/classes/Symbol.html +0 -179
  63. data/doc/rdoc/created.rid +0 -1
  64. data/doc/rdoc/files/LICENSE.html +0 -129
  65. data/doc/rdoc/files/README.html +0 -417
  66. data/doc/rdoc/files/TODO.html +0 -151
  67. data/doc/rdoc/files/lib/merb/merb_class_extensions_rb.html +0 -101
  68. data/doc/rdoc/files/lib/merb/merb_controller_rb.html +0 -101
  69. data/doc/rdoc/files/lib/merb/merb_handler_rb.html +0 -101
  70. data/doc/rdoc/files/lib/merb/merb_router_rb.html +0 -101
  71. data/doc/rdoc/files/lib/merb/merb_utils_rb.html +0 -108
  72. data/doc/rdoc/files/lib/merb/mixins/controller_mixin_rb.html +0 -101
  73. data/doc/rdoc/files/lib/merb/mixins/render_mixin_rb.html +0 -101
  74. data/doc/rdoc/files/lib/merb/session/merb_session_rb.html +0 -101
  75. data/doc/rdoc/files/lib/merb_rb.html +0 -140
  76. data/doc/rdoc/files/lib/merb_tasks_rb.html +0 -101
  77. data/doc/rdoc/fr_class_index.html +0 -43
  78. data/doc/rdoc/fr_file_index.html +0 -40
  79. data/doc/rdoc/fr_method_index.html +0 -104
  80. data/doc/rdoc/index.html +0 -24
  81. data/doc/rdoc/rdoc-style.css +0 -208
  82. data/examples/sample_app/dist/app/controllers/upload.rb +0 -29
  83. data/examples/sample_app/dist/app/views/posts/comment.merbjs +0 -1
  84. data/examples/sample_app/dist/app/views/upload/start.rhtml +0 -15
  85. data/examples/sample_app/dist/app/views/upload/upload.rhtml +0 -4
  86. data/examples/sample_app/dist/public/files/README +0 -35
  87. data/examples/sample_app/dist/public/files/setup.rb +0 -1346
  88. data/examples/sample_app/log/merb.log +0 -778
@@ -1,430 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: MerbHandler</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">MerbHandler</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/merb/merb_handler_rb.html">
59
- lib/merb/merb_handler.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- <tr class="top-aligned-row">
66
- <td><strong>Parent:</strong></td>
67
- <td>
68
- Mongrel::HttpHandler
69
- </td>
70
- </tr>
71
- </table>
72
- </div>
73
- <!-- banner header -->
74
-
75
- <div id="bodyContent">
76
-
77
-
78
-
79
- <div id="contextContent">
80
-
81
-
82
-
83
- </div>
84
-
85
- <div id="method-list">
86
- <h3 class="section-bar">Methods</h3>
87
-
88
- <div class="name-list">
89
- <a href="#M000008">exception</a>&nbsp;&nbsp;
90
- <a href="#M000005">handle</a>&nbsp;&nbsp;
91
- <a href="#M000007">html_exception</a>&nbsp;&nbsp;
92
- <a href="#M000006">instantiate_controller</a>&nbsp;&nbsp;
93
- <a href="#M000003">new</a>&nbsp;&nbsp;
94
- <a href="#M000004">process</a>&nbsp;&nbsp;
95
- </div>
96
- </div>
97
-
98
- </div>
99
-
100
-
101
- <!-- if includes -->
102
-
103
- <div id="section">
104
-
105
-
106
-
107
-
108
-
109
-
110
-
111
-
112
- <!-- if method_list -->
113
- <div id="methods">
114
- <h3 class="section-bar">Public Class methods</h3>
115
-
116
- <div id="method-M000003" class="method-detail">
117
- <a name="M000003"></a>
118
-
119
- <div class="method-heading">
120
- <a href="#M000003" class="method-signature">
121
- <span class="method-name">new</span><span class="method-args">(dir, opts = {})</span>
122
- </a>
123
- </div>
124
-
125
- <div class="method-description">
126
- <p>
127
- take the name of a directory and use that as the doc root or public
128
- directory of your site. This is set to the root of your merb app +
129
- &#8217;/public&#8217; by default.
130
- </p>
131
- <p><a class="source-toggle" href="#"
132
- onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
133
- <div class="method-source-code" id="M000003-source">
134
- <pre>
135
- <span class="ruby-comment cmt"># File lib/merb/merb_handler.rb, line 8</span>
136
- 8: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">dir</span>, <span class="ruby-identifier">opts</span> = {})
137
- 9: <span class="ruby-ivar">@files</span> = <span class="ruby-constant">Mongrel</span><span class="ruby-operator">::</span><span class="ruby-constant">DirHandler</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">dir</span>,<span class="ruby-keyword kw">false</span>)
138
- 10: <span class="ruby-ivar">@guard</span> = <span class="ruby-constant">Mutex</span>.<span class="ruby-identifier">new</span>
139
- 11: <span class="ruby-keyword kw">end</span>
140
- </pre>
141
- </div>
142
- </div>
143
- </div>
144
-
145
- <h3 class="section-bar">Public Instance methods</h3>
146
-
147
- <div id="method-M000008" class="method-detail">
148
- <a name="M000008"></a>
149
-
150
- <div class="method-heading">
151
- <a href="#M000008" class="method-signature">
152
- <span class="method-name">exception</span><span class="method-args">(e)</span>
153
- </a>
154
- </div>
155
-
156
- <div class="method-description">
157
- <p><a class="source-toggle" href="#"
158
- onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
159
- <div class="method-source-code" id="M000008-source">
160
- <pre>
161
- <span class="ruby-comment cmt"># File lib/merb/merb_handler.rb, line 150</span>
162
- 150: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exception</span>(<span class="ruby-identifier">e</span>)
163
- 151: <span class="ruby-node">&quot;#{ e.message } - (#{ e.class })\n&quot;</span> <span class="ruby-operator">&lt;&lt;</span>
164
- 152: <span class="ruby-node">&quot;#{(e.backtrace or []).join(&quot;\n&quot;)}&quot;</span>
165
- 153: <span class="ruby-keyword kw">end</span>
166
- </pre>
167
- </div>
168
- </div>
169
- </div>
170
-
171
- <div id="method-M000005" class="method-detail">
172
- <a name="M000005"></a>
173
-
174
- <div class="method-heading">
175
- <a href="#M000005" class="method-signature">
176
- <span class="method-name">handle</span><span class="method-args">(request)</span>
177
- </a>
178
- </div>
179
-
180
- <div class="method-description">
181
- <p>
182
- This is where we grab the incoming request PATH_INFO and use that in the
183
- merb routematcher to determine which controller and method to run. returns
184
- a 2 element tuple of: [controller, action]
185
- </p>
186
- <p><a class="source-toggle" href="#"
187
- onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
188
- <div class="method-source-code" id="M000005-source">
189
- <pre>
190
- <span class="ruby-comment cmt"># File lib/merb/merb_handler.rb, line 113</span>
191
- 113: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle</span>(<span class="ruby-identifier">request</span>)
192
- 114: <span class="ruby-identifier">path</span> = <span class="ruby-identifier">request</span>.<span class="ruby-identifier">params</span>[<span class="ruby-constant">Mongrel</span><span class="ruby-operator">::</span><span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH_INFO</span>].<span class="ruby-identifier">sub</span>(<span class="ruby-regexp re">/\/+/</span>, <span class="ruby-value str">'/'</span>)
193
- 115: <span class="ruby-identifier">path</span> = <span class="ruby-identifier">path</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>] <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">path</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?/</span>)
194
- 116: <span class="ruby-identifier">route</span> = <span class="ruby-constant">Merb</span><span class="ruby-operator">::</span><span class="ruby-constant">RouteMatcher</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">route_request</span>(<span class="ruby-identifier">path</span>)
195
- 117: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">route</span>
196
- 118: <span class="ruby-constant">MERB_LOGGER</span>.<span class="ruby-identifier">info</span>(<span class="ruby-value str">&quot;No Matching Route!&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">route</span>[<span class="ruby-identifier">:controller</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'Noroutefound'</span>
197
- 119: [ <span class="ruby-identifier">instantiate_controller</span>(<span class="ruby-identifier">route</span>[<span class="ruby-identifier">:controller</span>], <span class="ruby-identifier">request</span>.<span class="ruby-identifier">body</span>, <span class="ruby-identifier">request</span>.<span class="ruby-identifier">params</span>, <span class="ruby-identifier">route</span>),
198
- 120: <span class="ruby-identifier">route</span>[<span class="ruby-identifier">:action</span>] ]
199
- 121: <span class="ruby-keyword kw">else</span>
200
- 122: <span class="ruby-constant">MERB_LOGGER</span>.<span class="ruby-identifier">info</span>(<span class="ruby-value str">&quot;No Matching Route!&quot;</span>)
201
- 123: [<span class="ruby-value str">&quot;&lt;html&gt;&lt;body&gt;Error: no route matches!&lt;/body&gt;&lt;/html&gt;&quot;</span>, <span class="ruby-keyword kw">nil</span>]
202
- 124: <span class="ruby-keyword kw">end</span>
203
- 125: <span class="ruby-keyword kw">end</span>
204
- </pre>
205
- </div>
206
- </div>
207
- </div>
208
-
209
- <div id="method-M000007" class="method-detail">
210
- <a name="M000007"></a>
211
-
212
- <div class="method-heading">
213
- <a href="#M000007" class="method-signature">
214
- <span class="method-name">html_exception</span><span class="method-args">(e)</span>
215
- </a>
216
- </div>
217
-
218
- <div class="method-description">
219
- <p>
220
- format <a href="MerbHandler.html#M000008">exception</a> message for browser
221
- display
222
- </p>
223
- <p><a class="source-toggle" href="#"
224
- onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
225
- <div class="method-source-code" id="M000007-source">
226
- <pre>
227
- <span class="ruby-comment cmt"># File lib/merb/merb_handler.rb, line 145</span>
228
- 145: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">html_exception</span>(<span class="ruby-identifier">e</span>)
229
- 146: <span class="ruby-node">&quot;&lt;html&gt;&lt;h2&gt;Merb Error!&lt;/h2&gt;&lt;p&gt;#{ e.message } - (#{ e.class })\n&quot;</span> <span class="ruby-operator">&lt;&lt;</span>
230
- 147: <span class="ruby-node">&quot;#{(e.backtrace or []).join('&lt;br /&gt;')}&lt;/p&gt;&lt;/html&gt;&quot;</span>
231
- 148: <span class="ruby-keyword kw">end</span>
232
- </pre>
233
- </div>
234
- </div>
235
- </div>
236
-
237
- <div id="method-M000006" class="method-detail">
238
- <a name="M000006"></a>
239
-
240
- <div class="method-heading">
241
- <a href="#M000006" class="method-signature">
242
- <span class="method-name">instantiate_controller</span><span class="method-args">(controller_name, req, env, params)</span>
243
- </a>
244
- </div>
245
-
246
- <div class="method-description">
247
- <p>
248
- take a controller class name string and reload or require the right
249
- controller file then CamelCase it and turn it into a <a
250
- href="MerbHandler.html#M000003">new</a> object passing in the request and
251
- response. this is where your <a
252
- href="Merb/Controller.html">Merb::Controller</a> is instantiated.
253
- </p>
254
- <p><a class="source-toggle" href="#"
255
- onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
256
- <div class="method-source-code" id="M000006-source">
257
- <pre>
258
- <span class="ruby-comment cmt"># File lib/merb/merb_handler.rb, line 131</span>
259
- 131: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">instantiate_controller</span>(<span class="ruby-identifier">controller_name</span>, <span class="ruby-identifier">req</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">params</span>)
260
- 132: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-constant">Merb</span><span class="ruby-operator">::</span><span class="ruby-constant">Server</span>.<span class="ruby-identifier">config</span>[<span class="ruby-identifier">:dist_root</span>]<span class="ruby-operator">+</span><span class="ruby-node">&quot;/app/controllers/#{controller_name.snake_case}.rb&quot;</span>)
261
- 133: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Object</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">:Noroutefound</span>).<span class="ruby-identifier">new</span>(<span class="ruby-identifier">req</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">params</span>)
262
- 134: <span class="ruby-keyword kw">end</span>
263
- 135: <span class="ruby-keyword kw">begin</span>
264
- 136: <span class="ruby-identifier">controller_name</span>.<span class="ruby-identifier">import</span>
265
- 137: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Object</span>.<span class="ruby-identifier">const_get</span>( <span class="ruby-identifier">controller_name</span>.<span class="ruby-identifier">camel_case</span> ).<span class="ruby-identifier">new</span>(<span class="ruby-identifier">req</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">params</span>)
266
- 138: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span>
267
- 139: <span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;Error getting instance of '#{controller_name.camel_case}': #{$!}&quot;</span>
268
- 140: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">$!</span>
269
- 141: <span class="ruby-keyword kw">end</span>
270
- 142: <span class="ruby-keyword kw">end</span>
271
- </pre>
272
- </div>
273
- </div>
274
- </div>
275
-
276
- <div id="method-M000004" class="method-detail">
277
- <a name="M000004"></a>
278
-
279
- <div class="method-heading">
280
- <a href="#M000004" class="method-signature">
281
- <span class="method-name">process</span><span class="method-args">(request, response)</span>
282
- </a>
283
- </div>
284
-
285
- <div class="method-description">
286
- <p>
287
- <a href="MerbHandler.html#M000004">process</a> incoming http requests and
288
- do a number of things
289
- </p>
290
- <ol>
291
- <li>check for rails style cached pages. add .html to the
292
-
293
- </li>
294
- </ol>
295
- <p>
296
- url and see if there is a static file in public that matches. serve that
297
- file directly without invoking <a href="Merb.html">Merb</a> and be done
298
- with it.
299
- </p>
300
- <ol>
301
- <li>Serve static asset and html files directly from public/ if
302
-
303
- </li>
304
- </ol>
305
- <p>
306
- they exist.
307
- </p>
308
- <ol>
309
- <li>If none of the above apply, we take apart the request url
310
-
311
- </li>
312
- </ol>
313
- <p>
314
- and feed it into <a href="Merb/RouteMatcher.html">Merb::RouteMatcher</a> to
315
- let it decide which controller and method will serve the request.
316
- </p>
317
- <ol>
318
- <li>after the controller has done its thing, we check for the
319
-
320
- </li>
321
- </ol>
322
- <p>
323
- X-SENDFILE header. if you set this header to the path to a file in your
324
- controller then mongrel will serve the file directly and your controller
325
- can go on processing other requests.
326
- </p>
327
- <p><a class="source-toggle" href="#"
328
- onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
329
- <div class="method-source-code" id="M000004-source">
330
- <pre>
331
- <span class="ruby-comment cmt"># File lib/merb/merb_handler.rb, line 26</span>
332
- 26: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
333
- 27:
334
- 28: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">socket</span>.<span class="ruby-identifier">closed?</span>
335
- 29: <span class="ruby-keyword kw">return</span>
336
- 30: <span class="ruby-keyword kw">end</span>
337
- 31:
338
- 32: <span class="ruby-constant">MERB_LOGGER</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">&quot;Request: PATH_INFO: #{request.params[Mongrel::Const::PATH_INFO]}&quot;</span>)
339
- 33:
340
- 34: <span class="ruby-comment cmt"># Rails style page caching. Check the public dir first for</span>
341
- 35: <span class="ruby-comment cmt"># .html pages and serve directly. Otherwise fall back to Merb </span>
342
- 36: <span class="ruby-comment cmt"># routing and request dispatching. </span>
343
- 37: <span class="ruby-identifier">path_info</span> = <span class="ruby-identifier">request</span>.<span class="ruby-identifier">params</span>[<span class="ruby-constant">Mongrel</span><span class="ruby-operator">::</span><span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH_INFO</span>]
344
- 38: <span class="ruby-identifier">page_cached</span> = <span class="ruby-identifier">path_info</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;.html&quot;</span>
345
- 39: <span class="ruby-identifier">get_or_head</span> = <span class="ruby-ivar">@@file_only_methods</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">params</span>[<span class="ruby-constant">Mongrel</span><span class="ruby-operator">::</span><span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">REQUEST_METHOD</span>]
346
- 40:
347
- 41: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">get_or_head</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@files</span>.<span class="ruby-identifier">can_serve</span>(<span class="ruby-identifier">path_info</span>)
348
- 42: <span class="ruby-comment cmt"># File exists as-is so serve it up</span>
349
- 43: <span class="ruby-constant">MERB_LOGGER</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">&quot;Serving static file: #{path_info}&quot;</span>)
350
- 44:
351
- 45: <span class="ruby-ivar">@files</span>.<span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>,<span class="ruby-identifier">response</span>)
352
- 46: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">get_or_head</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@files</span>.<span class="ruby-identifier">can_serve</span>(<span class="ruby-identifier">page_cached</span>)
353
- 47: <span class="ruby-comment cmt"># Possible cached page, serve it up</span>
354
- 48: <span class="ruby-constant">MERB_LOGGER</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">&quot;Serving static file: #{path_info}&quot;</span>)
355
- 49: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">params</span>[<span class="ruby-constant">Mongrel</span><span class="ruby-operator">::</span><span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH_INFO</span>] = <span class="ruby-identifier">page_cached</span>
356
- 50: <span class="ruby-ivar">@files</span>.<span class="ruby-identifier">process</span>(<span class="ruby-identifier">request</span>,<span class="ruby-identifier">response</span>)
357
- 51: <span class="ruby-keyword kw">else</span>
358
- 52: <span class="ruby-keyword kw">begin</span>
359
- 53: <span class="ruby-comment cmt"># This handles parsing the query string and post/file upload</span>
360
- 54: <span class="ruby-comment cmt"># params and is outside of the synchronize call so that</span>
361
- 55: <span class="ruby-comment cmt"># multiple file uploads can be done at once.</span>
362
- 56: <span class="ruby-identifier">controller</span>, <span class="ruby-identifier">action</span> = <span class="ruby-identifier">handle</span>(<span class="ruby-identifier">request</span>)
363
- 57: <span class="ruby-constant">MERB_LOGGER</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">&quot;Routing to controller: #{controller.class} action: #{action}&quot;</span>)
364
- 58: <span class="ruby-identifier">output</span> = <span class="ruby-keyword kw">nil</span>
365
- 59: <span class="ruby-comment cmt"># synchronize here because this is where ActiveRecord or your db</span>
366
- 60: <span class="ruby-comment cmt"># calls will be run in your controller methods.</span>
367
- 61: <span class="ruby-ivar">@guard</span>.<span class="ruby-identifier">synchronize</span> {
368
- 62: <span class="ruby-identifier">output</span> = <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">dispatch</span>(<span class="ruby-identifier">action</span>)
369
- 63: }
370
- 64: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
371
- 65: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">start</span>(<span class="ruby-value">500</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">head</span>,<span class="ruby-identifier">out</span><span class="ruby-operator">|</span>
372
- 66: <span class="ruby-identifier">head</span>[<span class="ruby-value str">&quot;Content-Type&quot;</span>] = <span class="ruby-value str">&quot;text/html&quot;</span>
373
- 67: <span class="ruby-constant">MERB_LOGGER</span>.<span class="ruby-identifier">info</span>(<span class="ruby-identifier">exception</span>(<span class="ruby-identifier">e</span>))
374
- 68: <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">html_exception</span>(<span class="ruby-identifier">e</span>)
375
- 69: <span class="ruby-keyword kw">end</span>
376
- 70: <span class="ruby-keyword kw">return</span>
377
- 71: <span class="ruby-keyword kw">end</span>
378
- 72:
379
- 73: <span class="ruby-identifier">sendfile</span>, <span class="ruby-identifier">clength</span> = <span class="ruby-keyword kw">nil</span>
380
- 74: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span> = <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">status</span>
381
- 75:
382
- 76: <span class="ruby-comment cmt"># check for the X-SENDFILE header from your Merb::Controller</span>
383
- 77: <span class="ruby-comment cmt"># and serve the file directly instead of buffering.</span>
384
- 78: <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">headers</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>
385
- 79: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^X-SENDFILE$/i</span>
386
- 80: <span class="ruby-identifier">sendfile</span> = <span class="ruby-identifier">v</span>
387
- 81: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^CONTENT-LENGTH$/i</span>
388
- 82: <span class="ruby-identifier">clength</span> = <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_i</span>
389
- 83: <span class="ruby-keyword kw">else</span>
390
- 84: [<span class="ruby-operator">*</span><span class="ruby-identifier">v</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">vi</span><span class="ruby-operator">|</span>
391
- 85: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">header</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">vi</span>
392
- 86: <span class="ruby-keyword kw">end</span>
393
- 87: <span class="ruby-keyword kw">end</span>
394
- 88: <span class="ruby-keyword kw">end</span>
395
- 89:
396
- 90: <span class="ruby-identifier">controller</span> = <span class="ruby-keyword kw">nil</span>
397
- 91:
398
- 92: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">sendfile</span>
399
- 93: <span class="ruby-constant">MERB_LOGGER</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">&quot;X-SENDFILE: #{sendfile}&quot;</span>)
400
- 94: <span class="ruby-comment cmt"># send X-SENDFILE header to mongrel</span>
401
- 95: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">send_status</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">size</span>(<span class="ruby-identifier">sendfile</span>))
402
- 96: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">send_header</span>
403
- 97: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">send_file</span>(<span class="ruby-identifier">sendfile</span>)
404
- 98: <span class="ruby-keyword kw">else</span>
405
- 99: <span class="ruby-constant">MERB_LOGGER</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">&quot;Response status: #{response.status}\n\n&quot;</span>)
406
- 100: <span class="ruby-comment cmt"># render response from successful controller</span>
407
- 101: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">send_status</span>((<span class="ruby-identifier">output</span><span class="ruby-operator">||</span><span class="ruby-value str">''</span>).<span class="ruby-identifier">length</span>)
408
- 102: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">send_header</span>
409
- 103: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">output</span>)
410
- 104: <span class="ruby-keyword kw">end</span>
411
- 105: <span class="ruby-keyword kw">end</span>
412
- 106: <span class="ruby-keyword kw">end</span>
413
- </pre>
414
- </div>
415
- </div>
416
- </div>
417
-
418
-
419
- </div>
420
-
421
-
422
- </div>
423
-
424
-
425
- <div id="validator-badges">
426
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
427
- </div>
428
-
429
- </body>
430
- </html>
@@ -1,469 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: MerbHash</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">MerbHash</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/merb/merb_utils_rb.html">
59
- lib/merb/merb_utils.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- <tr class="top-aligned-row">
66
- <td><strong>Parent:</strong></td>
67
- <td>
68
- <a href="Hash.html">
69
- Hash
70
- </a>
71
- </td>
72
- </tr>
73
- </table>
74
- </div>
75
- <!-- banner header -->
76
-
77
- <div id="bodyContent">
78
-
79
-
80
-
81
- <div id="contextContent">
82
-
83
- <div id="description">
84
- <p>
85
- like HashWithIndifferentAccess from ActiveSupport.
86
- </p>
87
-
88
- </div>
89
-
90
-
91
- </div>
92
-
93
- <div id="method-list">
94
- <h3 class="section-bar">Methods</h3>
95
-
96
- <div class="name-list">
97
- <a href="#M000012">[]=</a>&nbsp;&nbsp;
98
- <a href="#M000021">convert_key</a>&nbsp;&nbsp;
99
- <a href="#M000022">convert_value</a>&nbsp;&nbsp;
100
- <a href="#M000011">default</a>&nbsp;&nbsp;
101
- <a href="#M000019">delete</a>&nbsp;&nbsp;
102
- <a href="#M000017">dup</a>&nbsp;&nbsp;
103
- <a href="#M000015">fetch</a>&nbsp;&nbsp;
104
- <a href="#M000014">key?</a>&nbsp;&nbsp;
105
- <a href="#M000018">merge</a>&nbsp;&nbsp;
106
- <a href="#M000020">method_missing</a>&nbsp;&nbsp;
107
- <a href="#M000010">new</a>&nbsp;&nbsp;
108
- <a href="#M000013">update</a>&nbsp;&nbsp;
109
- <a href="#M000016">values_at</a>&nbsp;&nbsp;
110
- </div>
111
- </div>
112
-
113
- </div>
114
-
115
-
116
- <!-- if includes -->
117
-
118
- <div id="section">
119
-
120
- <div id="class-list">
121
- <h3 class="section-bar">Classes and Modules</h3>
122
-
123
- Class <a href="MerbHash/Mutex.html" class="link">MerbHash::Mutex</a><br />
124
-
125
- </div>
126
-
127
-
128
- <div id="aliases-list">
129
- <h3 class="section-bar">External Aliases</h3>
130
-
131
- <div class="name-list">
132
- <table summary="aliases">
133
- <tr class="top-aligned-row context-row">
134
- <td class="context-item-name">[]=</td>
135
- <td>-&gt;</td>
136
- <td class="context-item-value">regular_writer</td>
137
- </tr>
138
- </table>
139
- </div>
140
- </div>
141
-
142
-
143
-
144
-
145
-
146
- <!-- if method_list -->
147
- <div id="methods">
148
- <h3 class="section-bar">Public Class methods</h3>
149
-
150
- <div id="method-M000010" class="method-detail">
151
- <a name="M000010"></a>
152
-
153
- <div class="method-heading">
154
- <a href="#M000010" class="method-signature">
155
- <span class="method-name">new</span><span class="method-args">(constructor = {})</span>
156
- </a>
157
- </div>
158
-
159
- <div class="method-description">
160
- <p><a class="source-toggle" href="#"
161
- onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
162
- <div class="method-source-code" id="M000010-source">
163
- <pre>
164
- <span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 54</span>
165
- 54: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">constructor</span> = {})
166
- 55: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">constructor</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
167
- 56: <span class="ruby-keyword kw">super</span>()
168
- 57: <span class="ruby-identifier">update</span>(<span class="ruby-identifier">constructor</span>)
169
- 58: <span class="ruby-keyword kw">else</span>
170
- 59: <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">constructor</span>)
171
- 60: <span class="ruby-keyword kw">end</span>
172
- 61: <span class="ruby-keyword kw">end</span>
173
- </pre>
174
- </div>
175
- </div>
176
- </div>
177
-
178
- <h3 class="section-bar">Public Instance methods</h3>
179
-
180
- <div id="method-M000012" class="method-detail">
181
- <a name="M000012"></a>
182
-
183
- <div class="method-heading">
184
- <a href="#M000012" class="method-signature">
185
- <span class="method-name">[]=</span><span class="method-args">(key, value)</span>
186
- </a>
187
- </div>
188
-
189
- <div class="method-description">
190
- <p><a class="source-toggle" href="#"
191
- onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
192
- <div class="method-source-code" id="M000012-source">
193
- <pre>
194
- <span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 71</span>
195
- 71: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
196
- 72: <span class="ruby-identifier">regular_writer</span>(<span class="ruby-identifier">convert_key</span>(<span class="ruby-identifier">key</span>), <span class="ruby-identifier">convert_value</span>(<span class="ruby-identifier">value</span>))
197
- 73: <span class="ruby-keyword kw">end</span>
198
- </pre>
199
- </div>
200
- </div>
201
- </div>
202
-
203
- <div id="method-M000021" class="method-detail">
204
- <a name="M000021"></a>
205
-
206
- <div class="method-heading">
207
- <a href="#M000021" class="method-signature">
208
- <span class="method-name">convert_key</span><span class="method-args">(key)</span>
209
- </a>
210
- </div>
211
-
212
- <div class="method-description">
213
- <p><a class="source-toggle" href="#"
214
- onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
215
- <div class="method-source-code" id="M000021-source">
216
- <pre>
217
- <span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 115</span>
218
- 115: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert_key</span>(<span class="ruby-identifier">key</span>)
219
- 116: <span class="ruby-identifier">key</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Symbol</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">key</span>
220
- 117: <span class="ruby-keyword kw">end</span>
221
- </pre>
222
- </div>
223
- </div>
224
- </div>
225
-
226
- <div id="method-M000022" class="method-detail">
227
- <a name="M000022"></a>
228
-
229
- <div class="method-heading">
230
- <a href="#M000022" class="method-signature">
231
- <span class="method-name">convert_value</span><span class="method-args">(value)</span>
232
- </a>
233
- </div>
234
-
235
- <div class="method-description">
236
- <p><a class="source-toggle" href="#"
237
- onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
238
- <div class="method-source-code" id="M000022-source">
239
- <pre>
240
- <span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 118</span>
241
- 118: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert_value</span>(<span class="ruby-identifier">value</span>)
242
- 119: <span class="ruby-identifier">value</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">with_indifferent_access</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">value</span>
243
- 120: <span class="ruby-keyword kw">end</span>
244
- </pre>
245
- </div>
246
- </div>
247
- </div>
248
-
249
- <div id="method-M000011" class="method-detail">
250
- <a name="M000011"></a>
251
-
252
- <div class="method-heading">
253
- <a href="#M000011" class="method-signature">
254
- <span class="method-name">default</span><span class="method-args">(key)</span>
255
- </a>
256
- </div>
257
-
258
- <div class="method-description">
259
- <p><a class="source-toggle" href="#"
260
- onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
261
- <div class="method-source-code" id="M000011-source">
262
- <pre>
263
- <span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 63</span>
264
- 63: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">default</span>(<span class="ruby-identifier">key</span>)
265
- 64: <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>)
266
- 65: <span class="ruby-keyword kw">end</span>
267
- </pre>
268
- </div>
269
- </div>
270
- </div>
271
-
272
- <div id="method-M000019" class="method-detail">
273
- <a name="M000019"></a>
274
-
275
- <div class="method-heading">
276
- <a href="#M000019" class="method-signature">
277
- <span class="method-name">delete</span><span class="method-args">(key)</span>
278
- </a>
279
- </div>
280
-
281
- <div class="method-description">
282
- <p><a class="source-toggle" href="#"
283
- onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
284
- <div class="method-source-code" id="M000019-source">
285
- <pre>
286
- <span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 106</span>
287
- 106: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>)
288
- 107: <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">convert_key</span>(<span class="ruby-identifier">key</span>))
289
- 108: <span class="ruby-keyword kw">end</span>
290
- </pre>
291
- </div>
292
- </div>
293
- </div>
294
-
295
- <div id="method-M000017" class="method-detail">
296
- <a name="M000017"></a>
297
-
298
- <div class="method-heading">
299
- <a href="#M000017" class="method-signature">
300
- <span class="method-name">dup</span><span class="method-args">()</span>
301
- </a>
302
- </div>
303
-
304
- <div class="method-description">
305
- <p><a class="source-toggle" href="#"
306
- onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
307
- <div class="method-source-code" id="M000017-source">
308
- <pre>
309
- <span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 98</span>
310
- 98: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dup</span>
311
- 99: <span class="ruby-constant">MerbHash</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>)
312
- 100: <span class="ruby-keyword kw">end</span>
313
- </pre>
314
- </div>
315
- </div>
316
- </div>
317
-
318
- <div id="method-M000015" class="method-detail">
319
- <a name="M000015"></a>
320
-
321
- <div class="method-heading">
322
- <a href="#M000015" class="method-signature">
323
- <span class="method-name">fetch</span><span class="method-args">(key, *extras)</span>
324
- </a>
325
- </div>
326
-
327
- <div class="method-description">
328
- <p><a class="source-toggle" href="#"
329
- onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
330
- <div class="method-source-code" id="M000015-source">
331
- <pre>
332
- <span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 90</span>
333
- 90: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">key</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">extras</span>)
334
- 91: <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">convert_key</span>(<span class="ruby-identifier">key</span>), <span class="ruby-operator">*</span><span class="ruby-identifier">extras</span>)
335
- 92: <span class="ruby-keyword kw">end</span>
336
- </pre>
337
- </div>
338
- </div>
339
- </div>
340
-
341
- <div id="method-M000014" class="method-detail">
342
- <a name="M000014"></a>
343
-
344
- <div class="method-heading">
345
- <a href="#M000014" class="method-signature">
346
- <span class="method-name">key?</span><span class="method-args">(key)</span>
347
- </a>
348
- </div>
349
-
350
- <div class="method-description">
351
- <p><a class="source-toggle" href="#"
352
- onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
353
- <div class="method-source-code" id="M000014-source">
354
- <pre>
355
- <span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 82</span>
356
- 82: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">key?</span>(<span class="ruby-identifier">key</span>)
357
- 83: <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">convert_key</span>(<span class="ruby-identifier">key</span>))
358
- 84: <span class="ruby-keyword kw">end</span>
359
- </pre>
360
- </div>
361
- </div>
362
- </div>
363
-
364
- <div id="method-M000018" class="method-detail">
365
- <a name="M000018"></a>
366
-
367
- <div class="method-heading">
368
- <a href="#M000018" class="method-signature">
369
- <span class="method-name">merge</span><span class="method-args">(hash)</span>
370
- </a>
371
- </div>
372
-
373
- <div class="method-description">
374
- <p><a class="source-toggle" href="#"
375
- onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
376
- <div class="method-source-code" id="M000018-source">
377
- <pre>
378
- <span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 102</span>
379
- 102: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">merge</span>(<span class="ruby-identifier">hash</span>)
380
- 103: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">update</span>(<span class="ruby-identifier">hash</span>)
381
- 104: <span class="ruby-keyword kw">end</span>
382
- </pre>
383
- </div>
384
- </div>
385
- </div>
386
-
387
- <div id="method-M000020" class="method-detail">
388
- <a name="M000020"></a>
389
-
390
- <div class="method-heading">
391
- <a href="#M000020" class="method-signature">
392
- <span class="method-name">method_missing</span><span class="method-args">(m,*a)</span>
393
- </a>
394
- </div>
395
-
396
- <div class="method-description">
397
- <p><a class="source-toggle" href="#"
398
- onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
399
- <div class="method-source-code" id="M000020-source">
400
- <pre>
401
- <span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 110</span>
402
- 110: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">m</span>,<span class="ruby-operator">*</span><span class="ruby-identifier">a</span>)
403
- 111: <span class="ruby-identifier">m</span>.<span class="ruby-identifier">to_s</span><span class="ruby-operator">=~</span><span class="ruby-regexp re">/=$/</span><span class="ruby-operator">?</span><span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">$`</span>]=<span class="ruby-identifier">a</span>[<span class="ruby-value">0</span>]<span class="ruby-operator">:</span><span class="ruby-identifier">a</span><span class="ruby-operator">==</span>[]<span class="ruby-operator">?</span><span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">m</span>]<span class="ruby-operator">:</span><span class="ruby-identifier">raise</span>(<span class="ruby-constant">NoMethodError</span>,<span class="ruby-node">&quot;#{m}&quot;</span>)
404
- 112: <span class="ruby-keyword kw">end</span>
405
- </pre>
406
- </div>
407
- </div>
408
- </div>
409
-
410
- <div id="method-M000013" class="method-detail">
411
- <a name="M000013"></a>
412
-
413
- <div class="method-heading">
414
- <a href="#M000013" class="method-signature">
415
- <span class="method-name">update</span><span class="method-args">(other_hash)</span>
416
- </a>
417
- </div>
418
-
419
- <div class="method-description">
420
- <p><a class="source-toggle" href="#"
421
- onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
422
- <div class="method-source-code" id="M000013-source">
423
- <pre>
424
- <span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 75</span>
425
- 75: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update</span>(<span class="ruby-identifier">other_hash</span>)
426
- 76: <span class="ruby-identifier">other_hash</span>.<span class="ruby-identifier">each_pair</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">regular_writer</span>(<span class="ruby-identifier">convert_key</span>(<span class="ruby-identifier">key</span>), <span class="ruby-identifier">convert_value</span>(<span class="ruby-identifier">value</span>)) }
427
- 77: <span class="ruby-keyword kw">self</span>
428
- 78: <span class="ruby-keyword kw">end</span>
429
- </pre>
430
- </div>
431
- </div>
432
- </div>
433
-
434
- <div id="method-M000016" class="method-detail">
435
- <a name="M000016"></a>
436
-
437
- <div class="method-heading">
438
- <a href="#M000016" class="method-signature">
439
- <span class="method-name">values_at</span><span class="method-args">(*indices)</span>
440
- </a>
441
- </div>
442
-
443
- <div class="method-description">
444
- <p><a class="source-toggle" href="#"
445
- onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
446
- <div class="method-source-code" id="M000016-source">
447
- <pre>
448
- <span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 94</span>
449
- 94: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">values_at</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">indices</span>)
450
- 95: <span class="ruby-identifier">indices</span>.<span class="ruby-identifier">collect</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">convert_key</span>(<span class="ruby-identifier">key</span>)]}
451
- 96: <span class="ruby-keyword kw">end</span>
452
- </pre>
453
- </div>
454
- </div>
455
- </div>
456
-
457
-
458
- </div>
459
-
460
-
461
- </div>
462
-
463
-
464
- <div id="validator-badges">
465
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
466
- </div>
467
-
468
- </body>
469
- </html>