merb 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +68 -58
- data/Rakefile +7 -6
- data/TODO +18 -0
- data/bin/merb +2 -2
- data/doc/rdoc/classes/Hash.html +148 -0
- data/doc/rdoc/classes/Merb/Config.html +161 -0
- data/doc/rdoc/classes/Merb/Controller.html +488 -0
- data/doc/rdoc/classes/Merb/RouteMatcher.html +354 -0
- data/doc/rdoc/classes/Merb/Server.html +288 -0
- data/doc/rdoc/classes/Merb.html +143 -0
- data/doc/rdoc/classes/MerbHandler.html +404 -0
- data/doc/rdoc/classes/MerbHash.html +457 -0
- data/doc/rdoc/classes/Noroutefound.html +172 -0
- data/doc/rdoc/classes/Object.html +149 -0
- data/doc/rdoc/classes/String.html +200 -0
- data/doc/rdoc/classes/Symbol.html +172 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/LICENSE.html +129 -0
- data/doc/rdoc/files/README.html +330 -0
- data/doc/rdoc/files/TODO.html +154 -0
- data/doc/rdoc/files/lib/merb/merb_controller_rb.html +101 -0
- data/doc/rdoc/files/lib/merb/merb_daemon_rb.html +113 -0
- data/doc/rdoc/files/lib/merb/merb_handler_rb.html +108 -0
- data/doc/rdoc/files/lib/merb/merb_router_rb.html +101 -0
- data/doc/rdoc/files/lib/merb/merb_utils_rb.html +101 -0
- data/doc/rdoc/files/lib/merb/noroutefound_rb.html +101 -0
- data/doc/rdoc/files/lib/merb_config_rb.html +101 -0
- data/doc/rdoc/files/lib/merb_rb.html +112 -0
- data/doc/rdoc/fr_class_index.html +38 -0
- data/doc/rdoc/fr_file_index.html +38 -0
- data/doc/rdoc/fr_method_index.html +78 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/examples/sample_app/{app → dist/app}/controllers/posts.rb +8 -8
- data/examples/sample_app/{app → dist/app}/controllers/test.rb +8 -5
- data/examples/sample_app/{app → dist/app}/controllers/upload.rb +13 -5
- data/examples/sample_app/dist/app/models/post.rb +13 -0
- data/examples/sample_app/dist/app/views/layout/application.rhtml +6 -0
- data/examples/sample_app/dist/app/views/layout/foo.rhtml +6 -0
- data/examples/sample_app/dist/app/views/layout/posts.rhtml +6 -0
- data/examples/sample_app/{app → dist/app}/views/posts/list.rhtml +1 -7
- data/examples/sample_app/{app → dist/app}/views/posts/new.rhtml +1 -7
- data/examples/sample_app/{app → dist/app}/views/posts/show.rhtml +1 -8
- data/examples/sample_app/dist/app/views/test/foo.rhtml +2 -0
- data/examples/sample_app/{app → dist/app}/views/test/hello.rhtml +1 -8
- data/examples/sample_app/{app → dist/app}/views/upload/start.rhtml +0 -8
- data/examples/sample_app/{app → dist/app}/views/upload/upload.rhtml +0 -0
- data/examples/sample_app/{conf → dist/conf}/merb_init.rb +5 -2
- data/examples/sample_app/{conf → dist/conf}/router.rb +6 -8
- data/examples/sample_app/test/test_helper.rb +1 -0
- data/examples/skeleton/dist/conf/merb_init.rb +21 -0
- data/examples/skeleton/dist/conf/router.rb +23 -0
- data/examples/skeleton/test/test_helper.rb +1 -0
- data/lib/merb/merb_controller.rb +54 -15
- data/lib/merb/merb_daemon.rb +35 -20
- data/lib/merb/merb_handler.rb +49 -38
- data/lib/merb/merb_router.rb +25 -28
- data/lib/merb/merb_utils.rb +98 -9
- data/{examples/sample_app/app/controllers → lib/merb}/noroutefound.rb +1 -1
- data/lib/merb.rb +4 -4
- data/lib/merb_config.rb +1 -1
- data/test/unit/route_matcher_test.rb +12 -31
- metadata +109 -28
- data/examples/sample_app/app/models/post.rb +0 -2
- data/examples/sample_app/app/views/test/foo.rhtml +0 -6
@@ -0,0 +1,488 @@
|
|
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: Merb::Controller</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">Merb::Controller</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/merb/merb_controller_rb.html">
|
59
|
+
lib/merb/merb_controller.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="../Object.html">
|
69
|
+
Object
|
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
|
+
All of your controllers will inherit from <a
|
86
|
+
href="Controller.html">Merb::Controller</a>. This superclass takes care of
|
87
|
+
parsing the incoming <a href="Controller.html#M000040">headers</a> and body
|
88
|
+
into <a href="Controller.html#M000038">params</a> and <a
|
89
|
+
href="Controller.html#M000039">cookies</a> and <a
|
90
|
+
href="Controller.html#M000040">headers</a>. If the request is a file upload
|
91
|
+
it will stream it into a tempfile and pass in the filename and tempfile
|
92
|
+
object to your controller via <a href="Controller.html#M000038">params</a>.
|
93
|
+
It also parses the ?query=string and puts that into <a
|
94
|
+
href="Controller.html#M000038">params</a> as well.
|
95
|
+
</p>
|
96
|
+
|
97
|
+
</div>
|
98
|
+
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<div id="method-list">
|
103
|
+
<h3 class="section-bar">Methods</h3>
|
104
|
+
|
105
|
+
<div class="name-list">
|
106
|
+
<a href="#M000039">cookies</a>
|
107
|
+
<a href="#M000045">current_method_name</a>
|
108
|
+
<a href="#M000042">escape</a>
|
109
|
+
<a href="#M000040">headers</a>
|
110
|
+
<a href="#M000046">layout</a>
|
111
|
+
<a href="#M000038">params</a>
|
112
|
+
<a href="#M000041">query_parse</a>
|
113
|
+
<a href="#M000036">redirect</a>
|
114
|
+
<a href="#M000048">render</a>
|
115
|
+
<a href="#M000047">render_no_layout</a>
|
116
|
+
<a href="#M000037">send_file</a>
|
117
|
+
<a href="#M000044">template_dir</a>
|
118
|
+
<a href="#M000043">unescape</a>
|
119
|
+
</div>
|
120
|
+
</div>
|
121
|
+
|
122
|
+
</div>
|
123
|
+
|
124
|
+
|
125
|
+
<!-- if includes -->
|
126
|
+
|
127
|
+
<div id="section">
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<div id="attribute-list">
|
134
|
+
<h3 class="section-bar">Attributes</h3>
|
135
|
+
|
136
|
+
<div class="name-list">
|
137
|
+
<table>
|
138
|
+
<tr class="top-aligned-row context-row">
|
139
|
+
<td class="context-item-name">status</td>
|
140
|
+
<td class="context-item-value"> [RW] </td>
|
141
|
+
<td class="context-item-desc"></td>
|
142
|
+
</tr>
|
143
|
+
</table>
|
144
|
+
</div>
|
145
|
+
</div>
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
<!-- if method_list -->
|
150
|
+
<div id="methods">
|
151
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
152
|
+
|
153
|
+
<div id="method-M000039" class="method-detail">
|
154
|
+
<a name="M000039"></a>
|
155
|
+
|
156
|
+
<div class="method-heading">
|
157
|
+
<a href="#M000039" class="method-signature">
|
158
|
+
<span class="method-name">cookies</span><span class="method-args">()</span>
|
159
|
+
</a>
|
160
|
+
</div>
|
161
|
+
|
162
|
+
<div class="method-description">
|
163
|
+
<p><a class="source-toggle" href="#"
|
164
|
+
onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
|
165
|
+
<div class="method-source-code" id="M000039-source">
|
166
|
+
<pre>
|
167
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_controller.rb, line 77</span>
|
168
|
+
77: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cookies</span>
|
169
|
+
78: <span class="ruby-ivar">@cookies</span>
|
170
|
+
79: <span class="ruby-keyword kw">end</span>
|
171
|
+
</pre>
|
172
|
+
</div>
|
173
|
+
</div>
|
174
|
+
</div>
|
175
|
+
|
176
|
+
<div id="method-M000045" class="method-detail">
|
177
|
+
<a name="M000045"></a>
|
178
|
+
|
179
|
+
<div class="method-heading">
|
180
|
+
<a href="#M000045" class="method-signature">
|
181
|
+
<span class="method-name">current_method_name</span><span class="method-args">(depth=0)</span>
|
182
|
+
</a>
|
183
|
+
</div>
|
184
|
+
|
185
|
+
<div class="method-description">
|
186
|
+
<p><a class="source-toggle" href="#"
|
187
|
+
onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
|
188
|
+
<div class="method-source-code" id="M000045-source">
|
189
|
+
<pre>
|
190
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_controller.rb, line 107</span>
|
191
|
+
107: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">current_method_name</span>(<span class="ruby-identifier">depth</span>=<span class="ruby-value">0</span>)
|
192
|
+
108: <span class="ruby-identifier">caller</span>[<span class="ruby-identifier">depth</span>] <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/`(.*)'$/</span>; <span class="ruby-identifier">$1</span>
|
193
|
+
109: <span class="ruby-keyword kw">end</span>
|
194
|
+
</pre>
|
195
|
+
</div>
|
196
|
+
</div>
|
197
|
+
</div>
|
198
|
+
|
199
|
+
<div id="method-M000042" class="method-detail">
|
200
|
+
<a name="M000042"></a>
|
201
|
+
|
202
|
+
<div class="method-heading">
|
203
|
+
<a href="#M000042" class="method-signature">
|
204
|
+
<span class="method-name">escape</span><span class="method-args">(s)</span>
|
205
|
+
</a>
|
206
|
+
</div>
|
207
|
+
|
208
|
+
<div class="method-description">
|
209
|
+
<p><a class="source-toggle" href="#"
|
210
|
+
onclick="toggleCode('M000042-source');return false;">[Source]</a></p>
|
211
|
+
<div class="method-source-code" id="M000042-source">
|
212
|
+
<pre>
|
213
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_controller.rb, line 94</span>
|
214
|
+
94: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escape</span>(<span class="ruby-identifier">s</span>)
|
215
|
+
95: <span class="ruby-constant">Mongrel</span><span class="ruby-operator">::</span><span class="ruby-constant">HttpRequest</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-identifier">s</span>)
|
216
|
+
96: <span class="ruby-keyword kw">end</span>
|
217
|
+
</pre>
|
218
|
+
</div>
|
219
|
+
</div>
|
220
|
+
</div>
|
221
|
+
|
222
|
+
<div id="method-M000040" class="method-detail">
|
223
|
+
<a name="M000040"></a>
|
224
|
+
|
225
|
+
<div class="method-heading">
|
226
|
+
<a href="#M000040" class="method-signature">
|
227
|
+
<span class="method-name">headers</span><span class="method-args">()</span>
|
228
|
+
</a>
|
229
|
+
</div>
|
230
|
+
|
231
|
+
<div class="method-description">
|
232
|
+
<p><a class="source-toggle" href="#"
|
233
|
+
onclick="toggleCode('M000040-source');return false;">[Source]</a></p>
|
234
|
+
<div class="method-source-code" id="M000040-source">
|
235
|
+
<pre>
|
236
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_controller.rb, line 81</span>
|
237
|
+
81: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">headers</span>
|
238
|
+
82: <span class="ruby-ivar">@headers</span>
|
239
|
+
83: <span class="ruby-keyword kw">end</span>
|
240
|
+
</pre>
|
241
|
+
</div>
|
242
|
+
</div>
|
243
|
+
</div>
|
244
|
+
|
245
|
+
<div id="method-M000046" class="method-detail">
|
246
|
+
<a name="M000046"></a>
|
247
|
+
|
248
|
+
<div class="method-heading">
|
249
|
+
<a href="#M000046" class="method-signature">
|
250
|
+
<span class="method-name">layout</span><span class="method-args">(l)</span>
|
251
|
+
</a>
|
252
|
+
</div>
|
253
|
+
|
254
|
+
<div class="method-description">
|
255
|
+
<p><a class="source-toggle" href="#"
|
256
|
+
onclick="toggleCode('M000046-source');return false;">[Source]</a></p>
|
257
|
+
<div class="method-source-code" id="M000046-source">
|
258
|
+
<pre>
|
259
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_controller.rb, line 112</span>
|
260
|
+
112: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">layout</span>(<span class="ruby-identifier">l</span>)
|
261
|
+
113: <span class="ruby-ivar">@layout</span> = <span class="ruby-identifier">l</span>
|
262
|
+
114: <span class="ruby-keyword kw">end</span>
|
263
|
+
</pre>
|
264
|
+
</div>
|
265
|
+
</div>
|
266
|
+
</div>
|
267
|
+
|
268
|
+
<div id="method-M000038" class="method-detail">
|
269
|
+
<a name="M000038"></a>
|
270
|
+
|
271
|
+
<div class="method-heading">
|
272
|
+
<a href="#M000038" class="method-signature">
|
273
|
+
<span class="method-name">params</span><span class="method-args">()</span>
|
274
|
+
</a>
|
275
|
+
</div>
|
276
|
+
|
277
|
+
<div class="method-description">
|
278
|
+
<p><a class="source-toggle" href="#"
|
279
|
+
onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
|
280
|
+
<div class="method-source-code" id="M000038-source">
|
281
|
+
<pre>
|
282
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_controller.rb, line 73</span>
|
283
|
+
73: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">params</span>
|
284
|
+
74: <span class="ruby-ivar">@params</span>
|
285
|
+
75: <span class="ruby-keyword kw">end</span>
|
286
|
+
</pre>
|
287
|
+
</div>
|
288
|
+
</div>
|
289
|
+
</div>
|
290
|
+
|
291
|
+
<div id="method-M000041" class="method-detail">
|
292
|
+
<a name="M000041"></a>
|
293
|
+
|
294
|
+
<div class="method-heading">
|
295
|
+
<a href="#M000041" class="method-signature">
|
296
|
+
<span class="method-name">query_parse</span><span class="method-args">(qs, d = '&;')</span>
|
297
|
+
</a>
|
298
|
+
</div>
|
299
|
+
|
300
|
+
<div class="method-description">
|
301
|
+
<p><a class="source-toggle" href="#"
|
302
|
+
onclick="toggleCode('M000041-source');return false;">[Source]</a></p>
|
303
|
+
<div class="method-source-code" id="M000041-source">
|
304
|
+
<pre>
|
305
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_controller.rb, line 85</span>
|
306
|
+
85: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">query_parse</span>(<span class="ruby-identifier">qs</span>, <span class="ruby-identifier">d</span> = <span class="ruby-value str">'&;'</span>)
|
307
|
+
86: <span class="ruby-identifier">m</span> = <span class="ruby-identifier">proc</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">_</span>,<span class="ruby-identifier">o</span>,<span class="ruby-identifier">n</span><span class="ruby-operator">|</span><span class="ruby-identifier">o</span>.<span class="ruby-identifier">update</span>(<span class="ruby-identifier">n</span>,<span class="ruby-operator">&</span><span class="ruby-identifier">m</span>)<span class="ruby-keyword kw">rescue</span>([<span class="ruby-operator">*</span><span class="ruby-identifier">o</span>]<span class="ruby-operator"><<</span><span class="ruby-identifier">n</span>)}
|
308
|
+
87: (<span class="ruby-identifier">qs</span><span class="ruby-operator">||</span><span class="ruby-value str">''</span>).<span class="ruby-identifier">split</span>(<span class="ruby-node">/[#{d}] */n</span>).<span class="ruby-identifier">inject</span>(<span class="ruby-constant">MerbHash</span>[]) { <span class="ruby-operator">|</span><span class="ruby-identifier">h</span>,<span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
|
309
|
+
88: <span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>=<span class="ruby-identifier">unescape</span>(<span class="ruby-identifier">p</span>).<span class="ruby-identifier">split</span>(<span class="ruby-value str">'='</span>,<span class="ruby-value">2</span>)
|
310
|
+
89: <span class="ruby-identifier">h</span>.<span class="ruby-identifier">update</span>(<span class="ruby-identifier">k</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/[\]\[]+/</span>).<span class="ruby-identifier">reverse</span>.
|
311
|
+
90: <span class="ruby-identifier">inject</span>(<span class="ruby-identifier">v</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span>,<span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-constant">MerbHash</span>[<span class="ruby-identifier">i</span>,<span class="ruby-identifier">x</span>] },<span class="ruby-operator">&</span><span class="ruby-identifier">m</span>)
|
312
|
+
91: }
|
313
|
+
92: <span class="ruby-keyword kw">end</span>
|
314
|
+
</pre>
|
315
|
+
</div>
|
316
|
+
</div>
|
317
|
+
</div>
|
318
|
+
|
319
|
+
<div id="method-M000036" class="method-detail">
|
320
|
+
<a name="M000036"></a>
|
321
|
+
|
322
|
+
<div class="method-heading">
|
323
|
+
<a href="#M000036" class="method-signature">
|
324
|
+
<span class="method-name">redirect</span><span class="method-args">(url)</span>
|
325
|
+
</a>
|
326
|
+
</div>
|
327
|
+
|
328
|
+
<div class="method-description">
|
329
|
+
<p><a class="source-toggle" href="#"
|
330
|
+
onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
|
331
|
+
<div class="method-source-code" id="M000036-source">
|
332
|
+
<pre>
|
333
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_controller.rb, line 62</span>
|
334
|
+
62: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">redirect</span>(<span class="ruby-identifier">url</span>)
|
335
|
+
63: <span class="ruby-ivar">@status</span> = <span class="ruby-value">302</span>
|
336
|
+
64: <span class="ruby-ivar">@headers</span>.<span class="ruby-identifier">merge!</span>({<span class="ruby-value str">'Location'</span>=<span class="ruby-operator">></span> <span class="ruby-identifier">url</span>})
|
337
|
+
65: <span class="ruby-keyword kw">return</span> <span class="ruby-value str">''</span>
|
338
|
+
66: <span class="ruby-keyword kw">end</span>
|
339
|
+
</pre>
|
340
|
+
</div>
|
341
|
+
</div>
|
342
|
+
</div>
|
343
|
+
|
344
|
+
<div id="method-M000048" class="method-detail">
|
345
|
+
<a name="M000048"></a>
|
346
|
+
|
347
|
+
<div class="method-heading">
|
348
|
+
<a href="#M000048" class="method-signature">
|
349
|
+
<span class="method-name">render</span><span class="method-args">(template=current_method_name(1), b=binding)</span>
|
350
|
+
</a>
|
351
|
+
</div>
|
352
|
+
|
353
|
+
<div class="method-description">
|
354
|
+
<p><a class="source-toggle" href="#"
|
355
|
+
onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
|
356
|
+
<div class="method-source-code" id="M000048-source">
|
357
|
+
<pre>
|
358
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_controller.rb, line 121</span>
|
359
|
+
121: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span>(<span class="ruby-identifier">template</span>=<span class="ruby-identifier">current_method_name</span>(<span class="ruby-value">1</span>), <span class="ruby-identifier">b</span>=<span class="ruby-identifier">binding</span>)
|
360
|
+
122: <span class="ruby-identifier">name</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">snake_case</span>
|
361
|
+
123: <span class="ruby-identifier">template</span> = <span class="ruby-constant">Erubis</span><span class="ruby-operator">::</span><span class="ruby-constant">Eruby</span>.<span class="ruby-identifier">new</span>( <span class="ruby-constant">IO</span>.<span class="ruby-identifier">read</span>( <span class="ruby-identifier">template_dir</span>(<span class="ruby-identifier">name</span>) <span class="ruby-operator">+</span> <span class="ruby-node">"/#{template}.rhtml"</span> ) )
|
362
|
+
124: <span class="ruby-identifier">layout_content</span> = <span class="ruby-identifier">template</span>.<span class="ruby-identifier">result</span>(<span class="ruby-identifier">b</span>)
|
363
|
+
125: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">layout_content</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@layout</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'none'</span>)
|
364
|
+
126: <span class="ruby-keyword kw">if</span> [<span class="ruby-value str">'application'</span>, <span class="ruby-identifier">name</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-ivar">@layout</span>.<span class="ruby-identifier">to_s</span>)
|
365
|
+
127: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">template_dir</span>(<span class="ruby-node">"layout/#{name}.rhtml"</span>))
|
366
|
+
128: <span class="ruby-identifier">layout</span> = <span class="ruby-identifier">name</span>
|
367
|
+
129: <span class="ruby-keyword kw">else</span>
|
368
|
+
130: <span class="ruby-identifier">layout</span> = <span class="ruby-value str">'application'</span>
|
369
|
+
131: <span class="ruby-keyword kw">end</span>
|
370
|
+
132: <span class="ruby-keyword kw">else</span>
|
371
|
+
133: <span class="ruby-identifier">layout</span> = <span class="ruby-ivar">@layout</span>.<span class="ruby-identifier">to_s</span>
|
372
|
+
134: <span class="ruby-keyword kw">end</span>
|
373
|
+
135: <span class="ruby-ivar">@layout_content</span> = <span class="ruby-identifier">layout_content</span>
|
374
|
+
136: <span class="ruby-identifier">layout_tmpl</span> = <span class="ruby-constant">Erubis</span><span class="ruby-operator">::</span><span class="ruby-constant">Eruby</span>.<span class="ruby-identifier">new</span>( <span class="ruby-constant">IO</span>.<span class="ruby-identifier">read</span>( <span class="ruby-identifier">template_dir</span>(<span class="ruby-value str">'layout'</span>) <span class="ruby-operator">+</span> <span class="ruby-node">"/#{layout}.rhtml"</span> ) )
|
375
|
+
137: <span class="ruby-identifier">layout_tmpl</span>.<span class="ruby-identifier">result</span>(<span class="ruby-identifier">b</span>)
|
376
|
+
138: <span class="ruby-keyword kw">end</span>
|
377
|
+
</pre>
|
378
|
+
</div>
|
379
|
+
</div>
|
380
|
+
</div>
|
381
|
+
|
382
|
+
<div id="method-M000047" class="method-detail">
|
383
|
+
<a name="M000047"></a>
|
384
|
+
|
385
|
+
<div class="method-heading">
|
386
|
+
<a href="#M000047" class="method-signature">
|
387
|
+
<span class="method-name">render_no_layout</span><span class="method-args">(template=current_method_name(1), b=binding)</span>
|
388
|
+
</a>
|
389
|
+
</div>
|
390
|
+
|
391
|
+
<div class="method-description">
|
392
|
+
<p><a class="source-toggle" href="#"
|
393
|
+
onclick="toggleCode('M000047-source');return false;">[Source]</a></p>
|
394
|
+
<div class="method-source-code" id="M000047-source">
|
395
|
+
<pre>
|
396
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_controller.rb, line 116</span>
|
397
|
+
116: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render_no_layout</span>(<span class="ruby-identifier">template</span>=<span class="ruby-identifier">current_method_name</span>(<span class="ruby-value">1</span>), <span class="ruby-identifier">b</span>=<span class="ruby-identifier">binding</span>)
|
398
|
+
117: <span class="ruby-identifier">template</span> = <span class="ruby-constant">Erubis</span><span class="ruby-operator">::</span><span class="ruby-constant">Eruby</span>.<span class="ruby-identifier">new</span>( <span class="ruby-constant">IO</span>.<span class="ruby-identifier">read</span>( <span class="ruby-identifier">template_dir</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">snake_case</span>) <span class="ruby-operator">+</span> <span class="ruby-node">"/#{template}.rhtml"</span> ) )
|
399
|
+
118: <span class="ruby-identifier">template</span>.<span class="ruby-identifier">result</span>(<span class="ruby-identifier">b</span>)
|
400
|
+
119: <span class="ruby-keyword kw">end</span>
|
401
|
+
</pre>
|
402
|
+
</div>
|
403
|
+
</div>
|
404
|
+
</div>
|
405
|
+
|
406
|
+
<div id="method-M000037" class="method-detail">
|
407
|
+
<a name="M000037"></a>
|
408
|
+
|
409
|
+
<div class="method-heading">
|
410
|
+
<a href="#M000037" class="method-signature">
|
411
|
+
<span class="method-name">send_file</span><span class="method-args">(file)</span>
|
412
|
+
</a>
|
413
|
+
</div>
|
414
|
+
|
415
|
+
<div class="method-description">
|
416
|
+
<p><a class="source-toggle" href="#"
|
417
|
+
onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
|
418
|
+
<div class="method-source-code" id="M000037-source">
|
419
|
+
<pre>
|
420
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_controller.rb, line 68</span>
|
421
|
+
68: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_file</span>(<span class="ruby-identifier">file</span>)
|
422
|
+
69: <span class="ruby-identifier">headers</span>[<span class="ruby-value str">'X-SENDFILE'</span>] = <span class="ruby-identifier">file</span>
|
423
|
+
70: <span class="ruby-keyword kw">return</span>
|
424
|
+
71: <span class="ruby-keyword kw">end</span>
|
425
|
+
</pre>
|
426
|
+
</div>
|
427
|
+
</div>
|
428
|
+
</div>
|
429
|
+
|
430
|
+
<div id="method-M000044" class="method-detail">
|
431
|
+
<a name="M000044"></a>
|
432
|
+
|
433
|
+
<div class="method-heading">
|
434
|
+
<a href="#M000044" class="method-signature">
|
435
|
+
<span class="method-name">template_dir</span><span class="method-args">(loc)</span>
|
436
|
+
</a>
|
437
|
+
</div>
|
438
|
+
|
439
|
+
<div class="method-description">
|
440
|
+
<p><a class="source-toggle" href="#"
|
441
|
+
onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
|
442
|
+
<div class="method-source-code" id="M000044-source">
|
443
|
+
<pre>
|
444
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_controller.rb, line 103</span>
|
445
|
+
103: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">template_dir</span>(<span class="ruby-identifier">loc</span>)
|
446
|
+
104: <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</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">:merb_root</span>] <span class="ruby-operator">+</span> <span class="ruby-node">"/dist/app/views/#{loc}"</span>)
|
447
|
+
105: <span class="ruby-keyword kw">end</span>
|
448
|
+
</pre>
|
449
|
+
</div>
|
450
|
+
</div>
|
451
|
+
</div>
|
452
|
+
|
453
|
+
<div id="method-M000043" class="method-detail">
|
454
|
+
<a name="M000043"></a>
|
455
|
+
|
456
|
+
<div class="method-heading">
|
457
|
+
<a href="#M000043" class="method-signature">
|
458
|
+
<span class="method-name">unescape</span><span class="method-args">(s)</span>
|
459
|
+
</a>
|
460
|
+
</div>
|
461
|
+
|
462
|
+
<div class="method-description">
|
463
|
+
<p><a class="source-toggle" href="#"
|
464
|
+
onclick="toggleCode('M000043-source');return false;">[Source]</a></p>
|
465
|
+
<div class="method-source-code" id="M000043-source">
|
466
|
+
<pre>
|
467
|
+
<span class="ruby-comment cmt"># File lib/merb/merb_controller.rb, line 98</span>
|
468
|
+
98: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unescape</span>(<span class="ruby-identifier">s</span>)
|
469
|
+
99: <span class="ruby-constant">Mongrel</span><span class="ruby-operator">::</span><span class="ruby-constant">HttpRequest</span>.<span class="ruby-identifier">unescape</span>(<span class="ruby-identifier">s</span>)
|
470
|
+
100: <span class="ruby-keyword kw">end</span>
|
471
|
+
</pre>
|
472
|
+
</div>
|
473
|
+
</div>
|
474
|
+
</div>
|
475
|
+
|
476
|
+
|
477
|
+
</div>
|
478
|
+
|
479
|
+
|
480
|
+
</div>
|
481
|
+
|
482
|
+
|
483
|
+
<div id="validator-badges">
|
484
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
485
|
+
</div>
|
486
|
+
|
487
|
+
</body>
|
488
|
+
</html>
|