merb 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README +41 -2
- data/Rakefile +4 -2
- data/TODO +3 -3
- data/bin/merb +157 -3
- data/doc/rdoc/classes/Hash.html +4 -4
- data/doc/rdoc/classes/Merb.html +2 -12
- data/doc/rdoc/classes/Merb/Controller.html +347 -156
- data/doc/rdoc/classes/Merb/RouteMatcher.html +93 -59
- data/doc/rdoc/classes/MerbHandler.html +117 -107
- data/doc/rdoc/classes/MerbHash.html +64 -58
- data/doc/rdoc/classes/Noroutefound.html +16 -10
- data/doc/rdoc/classes/Object.html +5 -5
- data/doc/rdoc/classes/String.html +28 -16
- data/doc/rdoc/classes/Symbol.html +15 -8
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README.html +56 -4
- data/doc/rdoc/files/TODO.html +4 -4
- data/doc/rdoc/files/lib/merb/merb_controller_rb.html +1 -1
- data/doc/rdoc/files/lib/merb/merb_handler_rb.html +1 -1
- data/doc/rdoc/files/lib/merb/merb_router_rb.html +1 -1
- data/doc/rdoc/files/lib/merb/merb_utils_rb.html +1 -1
- data/doc/rdoc/files/lib/merb_rb.html +30 -2
- data/doc/rdoc/files/lib/{merb_config_rb.html → merb_tasks_rb.html} +4 -4
- data/doc/rdoc/fr_class_index.html +0 -2
- data/doc/rdoc/fr_file_index.html +1 -3
- data/doc/rdoc/fr_method_index.html +21 -21
- data/examples/app_skeleton/Rakefile +81 -0
- data/examples/app_skeleton/dist/conf/merb_init.rb +15 -0
- data/examples/{skeleton → app_skeleton}/dist/conf/router.rb +5 -7
- data/examples/app_skeleton/scripts/merb_stop +5 -0
- data/examples/app_skeleton/scripts/new_migration +21 -0
- data/examples/{skeleton → app_skeleton}/test/test_helper.rb +0 -0
- data/examples/sample_app/Rakefile +81 -0
- data/examples/sample_app/dist/app/controllers/posts.rb +26 -10
- data/examples/sample_app/dist/app/models/comment.rb +3 -0
- data/examples/sample_app/dist/app/models/post.rb +2 -11
- data/examples/sample_app/dist/app/views/layout/application.rhtml +59 -4
- data/examples/sample_app/dist/app/views/posts/_comments.rhtml +11 -0
- data/examples/sample_app/dist/app/views/posts/comment.merbjs +1 -0
- data/examples/sample_app/dist/app/views/posts/list.rhtml +2 -4
- data/examples/sample_app/dist/app/views/posts/new.rhtml +2 -2
- data/examples/sample_app/dist/app/views/posts/show.rhtml +35 -3
- data/examples/sample_app/dist/conf/merb_init.rb +2 -4
- data/examples/sample_app/dist/conf/router.rb +3 -4
- data/examples/sample_app/dist/public/images/bg.jpg +0 -0
- data/examples/sample_app/dist/public/images/book.gif +0 -0
- data/examples/sample_app/dist/public/images/booksmall.gif +0 -0
- data/examples/sample_app/dist/public/images/greenright.jpg +0 -0
- data/examples/sample_app/dist/public/images/louiecon.gif +0 -0
- data/examples/sample_app/dist/public/images/menu.gif +0 -0
- data/examples/sample_app/dist/public/images/menuleft.gif +0 -0
- data/examples/sample_app/dist/public/images/menuright.gif +0 -0
- data/examples/sample_app/dist/public/images/mountain.jpg +0 -0
- data/examples/sample_app/dist/public/images/n3.jpg +0 -0
- data/examples/sample_app/dist/public/images/nautica.jpg +0 -0
- data/examples/sample_app/dist/public/javascripts/application.js +0 -0
- data/examples/sample_app/dist/public/javascripts/effects.js +975 -0
- data/examples/sample_app/dist/public/javascripts/prototype.js +2264 -0
- data/examples/sample_app/dist/public/stylesheets/merb.css +277 -0
- data/examples/sample_app/dist/schema/migrations/001_add_comments_to_posts.rb +22 -0
- data/examples/sample_app/dist/schema/schema.rb +22 -0
- data/examples/sample_app/log/merb.log +164394 -0
- data/examples/sample_app/script/merb_stop +9 -0
- data/examples/sample_app/script/new_migration +21 -0
- data/lib/merb.rb +7 -4
- data/lib/merb/merb_controller.rb +83 -4
- data/lib/merb/merb_handler.rb +20 -9
- data/lib/merb/merb_router.rb +18 -1
- data/lib/merb/merb_utils.rb +11 -1
- data/lib/merb_tasks.rb +7 -0
- data/lib/tasks/db.rake +53 -0
- metadata +67 -34
- data/doc/rdoc/classes/Merb/Config.html +0 -161
- data/doc/rdoc/classes/Merb/Server.html +0 -288
- data/doc/rdoc/files/lib/merb/merb_daemon_rb.html +0 -113
- data/doc/rdoc/files/lib/merb/noroutefound_rb.html +0 -101
- data/examples/sample_app/dist/app/views/layout/posts.rhtml +0 -6
- data/examples/skeleton/dist/conf/merb_init.rb +0 -21
- data/lib/merb/merb_daemon.rb +0 -91
- data/lib/merb/noroutefound.rb +0 -11
- data/lib/merb_config.rb +0 -21
@@ -80,6 +80,12 @@
|
|
80
80
|
|
81
81
|
<div id="contextContent">
|
82
82
|
|
83
|
+
<div id="description">
|
84
|
+
<p>
|
85
|
+
like HashWithIndifferentAccess from ActiveSupport.
|
86
|
+
</p>
|
87
|
+
|
88
|
+
</div>
|
83
89
|
|
84
90
|
|
85
91
|
</div>
|
@@ -149,15 +155,15 @@
|
|
149
155
|
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
150
156
|
<div class="method-source-code" id="M000009-source">
|
151
157
|
<pre>
|
152
|
-
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
158
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 54</span>
|
159
|
+
54: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">constructor</span> = {})
|
160
|
+
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>)
|
161
|
+
56: <span class="ruby-keyword kw">super</span>()
|
162
|
+
57: <span class="ruby-identifier">update</span>(<span class="ruby-identifier">constructor</span>)
|
163
|
+
58: <span class="ruby-keyword kw">else</span>
|
164
|
+
59: <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">constructor</span>)
|
165
|
+
60: <span class="ruby-keyword kw">end</span>
|
166
|
+
61: <span class="ruby-keyword kw">end</span>
|
161
167
|
</pre>
|
162
168
|
</div>
|
163
169
|
</div>
|
@@ -179,10 +185,10 @@
|
|
179
185
|
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
180
186
|
<div class="method-source-code" id="M000011-source">
|
181
187
|
<pre>
|
182
|
-
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line
|
183
|
-
|
184
|
-
|
185
|
-
|
188
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 70</span>
|
189
|
+
70: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
|
190
|
+
71: <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>))
|
191
|
+
72: <span class="ruby-keyword kw">end</span>
|
186
192
|
</pre>
|
187
193
|
</div>
|
188
194
|
</div>
|
@@ -202,10 +208,10 @@
|
|
202
208
|
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
203
209
|
<div class="method-source-code" id="M000020-source">
|
204
210
|
<pre>
|
205
|
-
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line
|
206
|
-
|
207
|
-
|
208
|
-
|
211
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 114</span>
|
212
|
+
114: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert_key</span>(<span class="ruby-identifier">key</span>)
|
213
|
+
115: <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>
|
214
|
+
116: <span class="ruby-keyword kw">end</span>
|
209
215
|
</pre>
|
210
216
|
</div>
|
211
217
|
</div>
|
@@ -225,10 +231,10 @@
|
|
225
231
|
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
226
232
|
<div class="method-source-code" id="M000021-source">
|
227
233
|
<pre>
|
228
|
-
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line
|
229
|
-
|
230
|
-
|
231
|
-
|
234
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 117</span>
|
235
|
+
117: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert_value</span>(<span class="ruby-identifier">value</span>)
|
236
|
+
118: <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>
|
237
|
+
119: <span class="ruby-keyword kw">end</span>
|
232
238
|
</pre>
|
233
239
|
</div>
|
234
240
|
</div>
|
@@ -248,10 +254,10 @@
|
|
248
254
|
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
249
255
|
<div class="method-source-code" id="M000010-source">
|
250
256
|
<pre>
|
251
|
-
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line
|
252
|
-
|
253
|
-
|
254
|
-
|
257
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 63</span>
|
258
|
+
63: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">default</span>(<span class="ruby-identifier">key</span>)
|
259
|
+
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>)
|
260
|
+
65: <span class="ruby-keyword kw">end</span>
|
255
261
|
</pre>
|
256
262
|
</div>
|
257
263
|
</div>
|
@@ -271,10 +277,10 @@
|
|
271
277
|
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
272
278
|
<div class="method-source-code" id="M000018-source">
|
273
279
|
<pre>
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
280
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 105</span>
|
281
|
+
105: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>)
|
282
|
+
106: <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">convert_key</span>(<span class="ruby-identifier">key</span>))
|
283
|
+
107: <span class="ruby-keyword kw">end</span>
|
278
284
|
</pre>
|
279
285
|
</div>
|
280
286
|
</div>
|
@@ -294,10 +300,10 @@
|
|
294
300
|
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
295
301
|
<div class="method-source-code" id="M000016-source">
|
296
302
|
<pre>
|
297
|
-
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line
|
298
|
-
|
299
|
-
|
300
|
-
|
303
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 97</span>
|
304
|
+
97: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dup</span>
|
305
|
+
98: <span class="ruby-constant">MerbHash</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>)
|
306
|
+
99: <span class="ruby-keyword kw">end</span>
|
301
307
|
</pre>
|
302
308
|
</div>
|
303
309
|
</div>
|
@@ -317,10 +323,10 @@
|
|
317
323
|
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
318
324
|
<div class="method-source-code" id="M000014-source">
|
319
325
|
<pre>
|
320
|
-
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line
|
321
|
-
|
322
|
-
|
323
|
-
|
326
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 89</span>
|
327
|
+
89: <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>)
|
328
|
+
90: <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>)
|
329
|
+
91: <span class="ruby-keyword kw">end</span>
|
324
330
|
</pre>
|
325
331
|
</div>
|
326
332
|
</div>
|
@@ -340,10 +346,10 @@
|
|
340
346
|
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
341
347
|
<div class="method-source-code" id="M000013-source">
|
342
348
|
<pre>
|
343
|
-
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line
|
344
|
-
|
345
|
-
|
346
|
-
|
349
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 81</span>
|
350
|
+
81: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">key?</span>(<span class="ruby-identifier">key</span>)
|
351
|
+
82: <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">convert_key</span>(<span class="ruby-identifier">key</span>))
|
352
|
+
83: <span class="ruby-keyword kw">end</span>
|
347
353
|
</pre>
|
348
354
|
</div>
|
349
355
|
</div>
|
@@ -363,10 +369,10 @@
|
|
363
369
|
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
364
370
|
<div class="method-source-code" id="M000017-source">
|
365
371
|
<pre>
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
372
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 101</span>
|
373
|
+
101: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">merge</span>(<span class="ruby-identifier">hash</span>)
|
374
|
+
102: <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>)
|
375
|
+
103: <span class="ruby-keyword kw">end</span>
|
370
376
|
</pre>
|
371
377
|
</div>
|
372
378
|
</div>
|
@@ -386,10 +392,10 @@
|
|
386
392
|
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
387
393
|
<div class="method-source-code" id="M000019-source">
|
388
394
|
<pre>
|
389
|
-
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line
|
390
|
-
|
391
|
-
|
392
|
-
|
395
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 109</span>
|
396
|
+
109: <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>)
|
397
|
+
110: <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">"#{m}"</span>)
|
398
|
+
111: <span class="ruby-keyword kw">end</span>
|
393
399
|
</pre>
|
394
400
|
</div>
|
395
401
|
</div>
|
@@ -409,11 +415,11 @@
|
|
409
415
|
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
410
416
|
<div class="method-source-code" id="M000012-source">
|
411
417
|
<pre>
|
412
|
-
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
418
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 74</span>
|
419
|
+
74: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update</span>(<span class="ruby-identifier">other_hash</span>)
|
420
|
+
75: <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>)) }
|
421
|
+
76: <span class="ruby-keyword kw">self</span>
|
422
|
+
77: <span class="ruby-keyword kw">end</span>
|
417
423
|
</pre>
|
418
424
|
</div>
|
419
425
|
</div>
|
@@ -433,10 +439,10 @@
|
|
433
439
|
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
434
440
|
<div class="method-source-code" id="M000015-source">
|
435
441
|
<pre>
|
436
|
-
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line
|
437
|
-
|
438
|
-
|
439
|
-
|
442
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 93</span>
|
443
|
+
93: <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>)
|
444
|
+
94: <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>)]}
|
445
|
+
95: <span class="ruby-keyword kw">end</span>
|
440
446
|
</pre>
|
441
447
|
</div>
|
442
448
|
</div>
|
@@ -55,8 +55,8 @@
|
|
55
55
|
<tr class="top-aligned-row">
|
56
56
|
<td><strong>In:</strong></td>
|
57
57
|
<td>
|
58
|
-
<a href="../files/lib/merb/
|
59
|
-
lib/merb/
|
58
|
+
<a href="../files/lib/merb/merb_controller_rb.html">
|
59
|
+
lib/merb/merb_controller.rb
|
60
60
|
</a>
|
61
61
|
<br />
|
62
62
|
</td>
|
@@ -121,14 +121,19 @@
|
|
121
121
|
</div>
|
122
122
|
|
123
123
|
<div class="method-description">
|
124
|
+
<p>
|
125
|
+
This is the class that handles requests that don‘t match any defined
|
126
|
+
routes.
|
127
|
+
</p>
|
124
128
|
<p><a class="source-toggle" href="#"
|
125
129
|
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
126
130
|
<div class="method-source-code" id="M000022-source">
|
127
131
|
<pre>
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_controller.rb, line 212</span>
|
133
|
+
212: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">sym</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">blk</span>)
|
134
|
+
213: <span class="ruby-ivar">@status</span> = <span class="ruby-value">404</span>
|
135
|
+
214: <span class="ruby-value str">"<html><body><h1>No Matching Route</h1></body></html>"</span>
|
136
|
+
215: <span class="ruby-keyword kw">end</span>
|
132
137
|
</pre>
|
133
138
|
</div>
|
134
139
|
</div>
|
@@ -148,10 +153,11 @@
|
|
148
153
|
onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
|
149
154
|
<div class="method-source-code" id="M000023-source">
|
150
155
|
<pre>
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
156
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_controller.rb, line 217</span>
|
157
|
+
217: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
158
|
+
218: <span class="ruby-ivar">@status</span> = <span class="ruby-value">404</span>
|
159
|
+
219: <span class="ruby-value str">"<html><body><h1>No Matching Route s</h1></body></html>"</span>
|
160
|
+
220: <span class="ruby-keyword kw">end</span>
|
155
161
|
</pre>
|
156
162
|
</div>
|
157
163
|
</div>
|
@@ -124,11 +124,11 @@
|
|
124
124
|
onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
|
125
125
|
<div class="method-source-code" id="M000024-source">
|
126
126
|
<pre>
|
127
|
-
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
127
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 40</span>
|
128
|
+
40: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">returning</span>(<span class="ruby-identifier">value</span>)
|
129
|
+
41: <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">value</span>)
|
130
|
+
42: <span class="ruby-identifier">value</span>
|
131
|
+
43: <span class="ruby-keyword kw">end</span>
|
132
132
|
</pre>
|
133
133
|
</div>
|
134
134
|
</div>
|
@@ -122,17 +122,21 @@
|
|
122
122
|
</div>
|
123
123
|
|
124
124
|
<div class="method-description">
|
125
|
+
<p>
|
126
|
+
"foo_bar".<a href="String.html#M000027">camel_case</a> #=>
|
127
|
+
"FooBar"
|
128
|
+
</p>
|
125
129
|
<p><a class="source-toggle" href="#"
|
126
130
|
onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
|
127
131
|
<div class="method-source-code" id="M000027-source">
|
128
132
|
<pre>
|
129
|
-
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
133
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 17</span>
|
134
|
+
17: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">camel_case</span>
|
135
|
+
18: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">%r/[A-Z]/</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">self</span> <span class="ruby-operator">!~</span> <span class="ruby-regexp re">%r/_/</span>
|
136
|
+
19: <span class="ruby-identifier">words</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">split</span> <span class="ruby-regexp re">%r/\s*_+\s*/</span>
|
137
|
+
20: <span class="ruby-identifier">words</span>.<span class="ruby-identifier">map!</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">w</span><span class="ruby-operator">|</span> <span class="ruby-identifier">w</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp re">%r/^./</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">upcase</span>}}
|
138
|
+
21: <span class="ruby-identifier">words</span>.<span class="ruby-identifier">join</span>
|
139
|
+
22: <span class="ruby-keyword kw">end</span>
|
136
140
|
</pre>
|
137
141
|
</div>
|
138
142
|
</div>
|
@@ -148,14 +152,18 @@
|
|
148
152
|
</div>
|
149
153
|
|
150
154
|
<div class="method-description">
|
155
|
+
<p>
|
156
|
+
reloads controller classes on each request if :allow_reloading is set to
|
157
|
+
true in the config file or command line options.
|
158
|
+
</p>
|
151
159
|
<p><a class="source-toggle" href="#"
|
152
160
|
onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
|
153
161
|
<div class="method-source-code" id="M000025-source">
|
154
162
|
<pre>
|
155
|
-
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line
|
156
|
-
|
157
|
-
|
158
|
-
|
163
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 6</span>
|
164
|
+
6: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">import</span>
|
165
|
+
7: <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">:allow_reloading</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">load</span>( <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">snake_case</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'.rb'</span> ) <span class="ruby-operator">:</span> <span class="ruby-identifier">require</span>( <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">snake_case</span> )
|
166
|
+
8: <span class="ruby-keyword kw">end</span>
|
159
167
|
</pre>
|
160
168
|
</div>
|
161
169
|
</div>
|
@@ -171,15 +179,19 @@
|
|
171
179
|
</div>
|
172
180
|
|
173
181
|
<div class="method-description">
|
182
|
+
<p>
|
183
|
+
"FooBar".<a href="String.html#M000026">snake_case</a> #=>
|
184
|
+
"foo_bar"
|
185
|
+
</p>
|
174
186
|
<p><a class="source-toggle" href="#"
|
175
187
|
onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
|
176
188
|
<div class="method-source-code" id="M000026-source">
|
177
189
|
<pre>
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
190
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 11</span>
|
191
|
+
11: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">snake_case</span>
|
192
|
+
12: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">%r/[A-Z]/</span>
|
193
|
+
13: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">reverse</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">%r/[A-Z]+|[^A-Z]*[A-Z]+?/</span>).<span class="ruby-identifier">reverse</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">word</span><span class="ruby-operator">|</span> <span class="ruby-identifier">word</span>.<span class="ruby-identifier">reverse</span>.<span class="ruby-identifier">downcase</span>}.<span class="ruby-identifier">join</span> <span class="ruby-value str">'_'</span>
|
194
|
+
14: <span class="ruby-keyword kw">end</span>
|
183
195
|
</pre>
|
184
196
|
</div>
|
185
197
|
</div>
|
@@ -121,14 +121,18 @@
|
|
121
121
|
</div>
|
122
122
|
|
123
123
|
<div class="method-description">
|
124
|
+
<p>
|
125
|
+
["foo", "bar"].map &:reverse #=>
|
126
|
+
[‘oof’, ‘rab’]
|
127
|
+
</p>
|
124
128
|
<p><a class="source-toggle" href="#"
|
125
129
|
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
126
130
|
<div class="method-source-code" id="M000002-source">
|
127
131
|
<pre>
|
128
|
-
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 34</span>
|
133
|
+
34: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_proc</span>
|
134
|
+
35: <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span>{<span class="ruby-operator">|</span><span class="ruby-operator">*</span><span class="ruby-identifier">args</span><span class="ruby-operator">|</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">shift</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)}
|
135
|
+
36: <span class="ruby-keyword kw">end</span>
|
132
136
|
</pre>
|
133
137
|
</div>
|
134
138
|
</div>
|
@@ -144,14 +148,17 @@
|
|
144
148
|
</div>
|
145
149
|
|
146
150
|
<div class="method-description">
|
151
|
+
<p>
|
152
|
+
faster <a href="Symbol.html#M000001">Symbol#to_s</a> to speed up routing.
|
153
|
+
</p>
|
147
154
|
<p><a class="source-toggle" href="#"
|
148
155
|
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
|
149
156
|
<div class="method-source-code" id="M000001-source">
|
150
157
|
<pre>
|
151
|
-
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line
|
152
|
-
|
153
|
-
|
154
|
-
|
158
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 29</span>
|
159
|
+
29: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
160
|
+
30: <span class="ruby-ivar">@str_rep</span> <span class="ruby-operator">||</span> (<span class="ruby-ivar">@str_rep</span> = <span class="ruby-identifier">id2name</span>.<span class="ruby-identifier">freeze</span>)
|
161
|
+
31: <span class="ruby-keyword kw">end</span>
|
155
162
|
</pre>
|
156
163
|
</div>
|
157
164
|
</div>
|
data/doc/rdoc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Wed Nov 01 18:48:54 -0800 2006
|
data/doc/rdoc/files/README.html
CHANGED
@@ -56,7 +56,7 @@
|
|
56
56
|
</tr>
|
57
57
|
<tr class="top-aligned-row">
|
58
58
|
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>
|
59
|
+
<td>Wed Nov 01 18:47:26 -0800 2006</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
</div>
|
@@ -113,8 +113,7 @@ params into params and the cookies into cookies when it instantiates your
|
|
113
113
|
controller class.
|
114
114
|
</p>
|
115
115
|
<ol>
|
116
|
-
<li>
|
117
|
-
compiles
|
116
|
+
<li>RouteMatcher and route compiler. Reads your route definition and compiles
|
118
117
|
|
119
118
|
</li>
|
120
119
|
</ol>
|
@@ -216,6 +215,46 @@ cookies.inspect %></h1> <% 5.times do %>
|
|
216
215
|
<p>
|
217
216
|
<% end %>
|
218
217
|
</p>
|
218
|
+
<p>
|
219
|
+
You can also render partials like so: <%= partial(:comments) %>
|
220
|
+
</p>
|
221
|
+
<p>
|
222
|
+
This assumes a _comments.rhtml file in the same view dir as the current
|
223
|
+
controller/view
|
224
|
+
</p>
|
225
|
+
<p>
|
226
|
+
<a href="../classes/Merb.html">Merb</a> also allows for returning
|
227
|
+
javascript instead of html for ajax actions You have to use the render_js
|
228
|
+
instead of normal render
|
229
|
+
</p>
|
230
|
+
<p>
|
231
|
+
def ajax_action
|
232
|
+
</p>
|
233
|
+
<pre>
|
234
|
+
@posts = Post.find :all
|
235
|
+
render_js
|
236
|
+
</pre>
|
237
|
+
<p>
|
238
|
+
end
|
239
|
+
</p>
|
240
|
+
<p>
|
241
|
+
# ajax_action.merbjs $(‘comments’).update(’<%=
|
242
|
+
escape_js(partial(:posts)) %>’);
|
243
|
+
</p>
|
244
|
+
<p>
|
245
|
+
# _posts.rhtml <ul>
|
246
|
+
</p>
|
247
|
+
<pre>
|
248
|
+
<% @posts.each do |p| %>
|
249
|
+
<li>
|
250
|
+
<%= p.title %><br />
|
251
|
+
<%= p.body %>
|
252
|
+
</li>
|
253
|
+
<% end %>
|
254
|
+
</pre>
|
255
|
+
<p>
|
256
|
+
</ul>
|
257
|
+
</p>
|
219
258
|
<ol>
|
220
259
|
<li>the server. right now you add your routes in
|
221
260
|
|
@@ -227,6 +266,17 @@ the appdir/conf/router.rb file. So by default it runs on port 4000
|
|
227
266
|
<p>
|
228
267
|
$ cd /path/to/your/merb/app $ merb
|
229
268
|
</p>
|
269
|
+
<p>
|
270
|
+
Or to start merb on a different port: $ merb -p 3500
|
271
|
+
</p>
|
272
|
+
<p>
|
273
|
+
To start a cluster of merb servers you specify the first port and then how
|
274
|
+
many servers you want spawned. SO this command will start a merb instance
|
275
|
+
on ports 3000, 3001, 3002
|
276
|
+
</p>
|
277
|
+
<p>
|
278
|
+
$ merb -p 3000 -c 3
|
279
|
+
</p>
|
230
280
|
<ol>
|
231
281
|
<li>File uploads. This is the thing that <a
|
232
282
|
href="../classes/Merb.html">Merb</a> was written for. Rails doesn‘t
|
@@ -274,13 +324,14 @@ MERB_ROOT to run the merb command line. ANd when you deploy live you will
|
|
274
324
|
put the dist dir into another empty MERB_ROOT on the production server.
|
275
325
|
</p>
|
276
326
|
<p>
|
277
|
-
|
327
|
+
app_skeleton
|
278
328
|
</p>
|
279
329
|
<pre>
|
280
330
|
Rakefile
|
281
331
|
README
|
282
332
|
scripts
|
283
333
|
test
|
334
|
+
test_helper.rb
|
284
335
|
fixtures
|
285
336
|
spec
|
286
337
|
unit
|
@@ -294,6 +345,7 @@ skeleton_app
|
|
294
345
|
lib
|
295
346
|
public
|
296
347
|
plugins
|
348
|
+
schema
|
297
349
|
</pre>
|
298
350
|
|
299
351
|
</div>
|