merb 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/README +41 -2
  2. data/Rakefile +4 -2
  3. data/TODO +3 -3
  4. data/bin/merb +157 -3
  5. data/doc/rdoc/classes/Hash.html +4 -4
  6. data/doc/rdoc/classes/Merb.html +2 -12
  7. data/doc/rdoc/classes/Merb/Controller.html +347 -156
  8. data/doc/rdoc/classes/Merb/RouteMatcher.html +93 -59
  9. data/doc/rdoc/classes/MerbHandler.html +117 -107
  10. data/doc/rdoc/classes/MerbHash.html +64 -58
  11. data/doc/rdoc/classes/Noroutefound.html +16 -10
  12. data/doc/rdoc/classes/Object.html +5 -5
  13. data/doc/rdoc/classes/String.html +28 -16
  14. data/doc/rdoc/classes/Symbol.html +15 -8
  15. data/doc/rdoc/created.rid +1 -1
  16. data/doc/rdoc/files/README.html +56 -4
  17. data/doc/rdoc/files/TODO.html +4 -4
  18. data/doc/rdoc/files/lib/merb/merb_controller_rb.html +1 -1
  19. data/doc/rdoc/files/lib/merb/merb_handler_rb.html +1 -1
  20. data/doc/rdoc/files/lib/merb/merb_router_rb.html +1 -1
  21. data/doc/rdoc/files/lib/merb/merb_utils_rb.html +1 -1
  22. data/doc/rdoc/files/lib/merb_rb.html +30 -2
  23. data/doc/rdoc/files/lib/{merb_config_rb.html → merb_tasks_rb.html} +4 -4
  24. data/doc/rdoc/fr_class_index.html +0 -2
  25. data/doc/rdoc/fr_file_index.html +1 -3
  26. data/doc/rdoc/fr_method_index.html +21 -21
  27. data/examples/app_skeleton/Rakefile +81 -0
  28. data/examples/app_skeleton/dist/conf/merb_init.rb +15 -0
  29. data/examples/{skeleton → app_skeleton}/dist/conf/router.rb +5 -7
  30. data/examples/app_skeleton/scripts/merb_stop +5 -0
  31. data/examples/app_skeleton/scripts/new_migration +21 -0
  32. data/examples/{skeleton → app_skeleton}/test/test_helper.rb +0 -0
  33. data/examples/sample_app/Rakefile +81 -0
  34. data/examples/sample_app/dist/app/controllers/posts.rb +26 -10
  35. data/examples/sample_app/dist/app/models/comment.rb +3 -0
  36. data/examples/sample_app/dist/app/models/post.rb +2 -11
  37. data/examples/sample_app/dist/app/views/layout/application.rhtml +59 -4
  38. data/examples/sample_app/dist/app/views/posts/_comments.rhtml +11 -0
  39. data/examples/sample_app/dist/app/views/posts/comment.merbjs +1 -0
  40. data/examples/sample_app/dist/app/views/posts/list.rhtml +2 -4
  41. data/examples/sample_app/dist/app/views/posts/new.rhtml +2 -2
  42. data/examples/sample_app/dist/app/views/posts/show.rhtml +35 -3
  43. data/examples/sample_app/dist/conf/merb_init.rb +2 -4
  44. data/examples/sample_app/dist/conf/router.rb +3 -4
  45. data/examples/sample_app/dist/public/images/bg.jpg +0 -0
  46. data/examples/sample_app/dist/public/images/book.gif +0 -0
  47. data/examples/sample_app/dist/public/images/booksmall.gif +0 -0
  48. data/examples/sample_app/dist/public/images/greenright.jpg +0 -0
  49. data/examples/sample_app/dist/public/images/louiecon.gif +0 -0
  50. data/examples/sample_app/dist/public/images/menu.gif +0 -0
  51. data/examples/sample_app/dist/public/images/menuleft.gif +0 -0
  52. data/examples/sample_app/dist/public/images/menuright.gif +0 -0
  53. data/examples/sample_app/dist/public/images/mountain.jpg +0 -0
  54. data/examples/sample_app/dist/public/images/n3.jpg +0 -0
  55. data/examples/sample_app/dist/public/images/nautica.jpg +0 -0
  56. data/examples/sample_app/dist/public/javascripts/application.js +0 -0
  57. data/examples/sample_app/dist/public/javascripts/effects.js +975 -0
  58. data/examples/sample_app/dist/public/javascripts/prototype.js +2264 -0
  59. data/examples/sample_app/dist/public/stylesheets/merb.css +277 -0
  60. data/examples/sample_app/dist/schema/migrations/001_add_comments_to_posts.rb +22 -0
  61. data/examples/sample_app/dist/schema/schema.rb +22 -0
  62. data/examples/sample_app/log/merb.log +164394 -0
  63. data/examples/sample_app/script/merb_stop +9 -0
  64. data/examples/sample_app/script/new_migration +21 -0
  65. data/lib/merb.rb +7 -4
  66. data/lib/merb/merb_controller.rb +83 -4
  67. data/lib/merb/merb_handler.rb +20 -9
  68. data/lib/merb/merb_router.rb +18 -1
  69. data/lib/merb/merb_utils.rb +11 -1
  70. data/lib/merb_tasks.rb +7 -0
  71. data/lib/tasks/db.rake +53 -0
  72. metadata +67 -34
  73. data/doc/rdoc/classes/Merb/Config.html +0 -161
  74. data/doc/rdoc/classes/Merb/Server.html +0 -288
  75. data/doc/rdoc/files/lib/merb/merb_daemon_rb.html +0 -113
  76. data/doc/rdoc/files/lib/merb/noroutefound_rb.html +0 -101
  77. data/examples/sample_app/dist/app/views/layout/posts.rhtml +0 -6
  78. data/examples/skeleton/dist/conf/merb_init.rb +0 -21
  79. data/lib/merb/merb_daemon.rb +0 -91
  80. data/lib/merb/noroutefound.rb +0 -11
  81. 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 44</span>
153
- 44: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">constructor</span> = {})
154
- 45: <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>)
155
- 46: <span class="ruby-keyword kw">super</span>()
156
- 47: <span class="ruby-identifier">update</span>(<span class="ruby-identifier">constructor</span>)
157
- 48: <span class="ruby-keyword kw">else</span>
158
- 49: <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">constructor</span>)
159
- 50: <span class="ruby-keyword kw">end</span>
160
- 51: <span class="ruby-keyword kw">end</span>
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 60</span>
183
- 60: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
184
- 61: <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>))
185
- 62: <span class="ruby-keyword kw">end</span>
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 104</span>
206
- 104: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert_key</span>(<span class="ruby-identifier">key</span>)
207
- 105: <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>
208
- 106: <span class="ruby-keyword kw">end</span>
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 107</span>
229
- 107: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert_value</span>(<span class="ruby-identifier">value</span>)
230
- 108: <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>
231
- 109: <span class="ruby-keyword kw">end</span>
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 53</span>
252
- 53: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">default</span>(<span class="ruby-identifier">key</span>)
253
- 54: <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>)
254
- 55: <span class="ruby-keyword kw">end</span>
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
- <span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 95</span>
275
- 95: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>)
276
- 96: <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">convert_key</span>(<span class="ruby-identifier">key</span>))
277
- 97: <span class="ruby-keyword kw">end</span>
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 87</span>
298
- 87: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dup</span>
299
- 88: <span class="ruby-constant">MerbHash</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>)
300
- 89: <span class="ruby-keyword kw">end</span>
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 79</span>
321
- 79: <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>)
322
- 80: <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>)
323
- 81: <span class="ruby-keyword kw">end</span>
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 71</span>
344
- 71: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">key?</span>(<span class="ruby-identifier">key</span>)
345
- 72: <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">convert_key</span>(<span class="ruby-identifier">key</span>))
346
- 73: <span class="ruby-keyword kw">end</span>
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
- <span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 91</span>
367
- 91: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">merge</span>(<span class="ruby-identifier">hash</span>)
368
- 92: <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>)
369
- 93: <span class="ruby-keyword kw">end</span>
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 99</span>
390
- 99: <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>)
391
- 100: <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>)
392
- 101: <span class="ruby-keyword kw">end</span>
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">&quot;#{m}&quot;</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 64</span>
413
- 64: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update</span>(<span class="ruby-identifier">other_hash</span>)
414
- 65: <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>)) }
415
- 66: <span class="ruby-keyword kw">self</span>
416
- 67: <span class="ruby-keyword kw">end</span>
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 83</span>
437
- 83: <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>)
438
- 84: <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>)]}
439
- 85: <span class="ruby-keyword kw">end</span>
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/noroutefound_rb.html">
59
- lib/merb/noroutefound.rb
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&#8216;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
- <span class="ruby-comment cmt"># File lib/merb/noroutefound.rb, line 3</span>
129
- 3: <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">&amp;</span><span class="ruby-identifier">blk</span>)
130
- 4: <span class="ruby-value str">&quot;&lt;html&gt;&lt;body&gt;&lt;h1&gt;No Matching Route&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;&quot;</span>
131
- 5: <span class="ruby-keyword kw">end</span>
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">&amp;</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">&quot;&lt;html&gt;&lt;body&gt;&lt;h1&gt;No Matching Route&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;&quot;</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
- <span class="ruby-comment cmt"># File lib/merb/noroutefound.rb, line 7</span>
152
- 7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
153
- 8: <span class="ruby-value str">&quot;&lt;html&gt;&lt;body&gt;&lt;h1&gt;No Matching Route s&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;&quot;</span>
154
- 9: <span class="ruby-keyword kw">end</span>
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">&quot;&lt;html&gt;&lt;body&gt;&lt;h1&gt;No Matching Route s&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;&quot;</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 31</span>
128
- 31: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">returning</span>(<span class="ruby-identifier">value</span>)
129
- 32: <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">value</span>)
130
- 33: <span class="ruby-identifier">value</span>
131
- 34: <span class="ruby-keyword kw">end</span>
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
+ &quot;foo_bar&quot;.<a href="String.html#M000027">camel_case</a> #=&gt;
127
+ &quot;FooBar&quot;
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 12</span>
130
- 12: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">camel_case</span>
131
- 13: <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>
132
- 14: <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>
133
- 15: <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>}}
134
- 16: <span class="ruby-identifier">words</span>.<span class="ruby-identifier">join</span>
135
- 17: <span class="ruby-keyword kw">end</span>
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 2</span>
156
- 2: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">import</span>
157
- 3: <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> )
158
- 4: <span class="ruby-keyword kw">end</span>
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
+ &quot;FooBar&quot;.<a href="String.html#M000026">snake_case</a> #=&gt;
184
+ &quot;foo_bar&quot;
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
- <span class="ruby-comment cmt"># File lib/merb/merb_utils.rb, line 6</span>
179
- 6: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">snake_case</span>
180
- 7: <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>
181
- 8: <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>
182
- 9: <span class="ruby-keyword kw">end</span>
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
+ [&quot;foo&quot;, &quot;bar&quot;].map &amp;:reverse #=&gt;
126
+ [&#8216;oof&#8217;, &#8216;rab&#8217;]
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 25</span>
129
- 25: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_proc</span>
130
- 26: <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>)}
131
- 27: <span class="ruby-keyword kw">end</span>
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 22</span>
152
- 22: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
153
- 23: <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>)
154
- 24: <span class="ruby-keyword kw">end</span>
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>
@@ -1 +1 @@
1
- Thu Oct 26 18:01:25 -0700 2006
1
+ Wed Nov 01 18:48:54 -0800 2006
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Thu Oct 26 18:01:00 -0700 2006</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>New RouteMatcher and route compiler. Reads your route definition and
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 %&gt;&lt;/h1&gt; &lt;% 5.times do %&gt;
216
215
  <p>
217
216
  &lt;% end %&gt;
218
217
  </p>
218
+ <p>
219
+ You can also render partials like so: &lt;%= partial(:comments) %&gt;
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 $(&#8216;comments&#8217;).update(&#8217;&lt;%=
242
+ escape_js(partial(:posts)) %&gt;&#8217;);
243
+ </p>
244
+ <p>
245
+ # _posts.rhtml &lt;ul&gt;
246
+ </p>
247
+ <pre>
248
+ &lt;% @posts.each do |p| %&gt;
249
+ &lt;li&gt;
250
+ &lt;%= p.title %&gt;&lt;br /&gt;
251
+ &lt;%= p.body %&gt;
252
+ &lt;/li&gt;
253
+ &lt;% end %&gt;
254
+ </pre>
255
+ <p>
256
+ &lt;/ul&gt;
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&#8216;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
- skeleton_app
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>