merb 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +22 -4
- data/Rakefile +15 -3
- data/TODO +2 -3
- data/bin/merb +61 -36
- data/examples/sample_app/dist/app/controllers/files.rb +31 -0
- data/examples/sample_app/dist/app/controllers/posts.rb +26 -2
- data/examples/sample_app/dist/app/controllers/test.rb +7 -1
- data/examples/sample_app/dist/app/views/files/progress.jerb +3 -0
- data/examples/sample_app/dist/app/views/files/start.herb +62 -0
- data/examples/sample_app/dist/app/views/files/upload.herb +6 -0
- data/examples/sample_app/dist/app/views/layout/{application.rhtml → application.herb} +2 -3
- data/examples/sample_app/dist/app/views/layout/{foo.rhtml → foo.herb} +0 -0
- data/examples/sample_app/dist/app/views/posts/{_comments.rhtml → _comments.herb} +0 -0
- data/examples/sample_app/dist/app/views/posts/comment.jerb +1 -0
- data/examples/sample_app/dist/app/views/posts/{list.rhtml → list.herb} +0 -0
- data/examples/sample_app/dist/app/views/posts/{new.rhtml → new.herb} +0 -0
- data/examples/sample_app/dist/app/views/posts/{show.rhtml → show.herb} +0 -0
- data/examples/sample_app/dist/app/views/posts/xml_test.xerb +3 -0
- data/examples/sample_app/dist/app/views/test/{foo.rhtml → foo.herb} +0 -0
- data/examples/sample_app/dist/app/views/test/{hello.rhtml → hello.herb} +0 -0
- data/examples/sample_app/dist/app/views/test/json.jerb +1 -0
- data/examples/sample_app/dist/conf/merb.yml +11 -0
- data/examples/sample_app/dist/conf/merb_init.rb +1 -1
- data/examples/sample_app/dist/conf/mup.conf +11 -0
- data/examples/sample_app/dist/public/javascripts/mup.js +113 -0
- data/examples/sample_app/script/merb_stop +7 -3
- data/examples/sample_app/script/startdrb +8 -0
- data/lib/merb.rb +37 -2
- data/lib/merb/merb_class_extensions.rb +21 -22
- data/lib/merb/merb_controller.rb +101 -33
- data/lib/merb/merb_handler.rb +26 -25
- data/lib/merb/merb_router.rb +1 -1
- data/lib/merb/merb_utils.rb +35 -37
- data/lib/merb/mixins/basic_authentication_mixin.rb +39 -0
- data/lib/merb/mixins/controller_mixin.rb +119 -115
- data/lib/merb/mixins/javascript_mixin.rb +63 -0
- data/lib/merb/mixins/render_mixin.rb +85 -69
- data/lib/merb/mixins/responder_mixin.rb +38 -0
- data/lib/merb/session/merb_drb_server.rb +107 -0
- data/lib/merb/session/merb_drb_session.rb +71 -0
- data/lib/merb/session/merb_session.rb +1 -0
- data/lib/merb/vendor/paginator/README.txt +84 -0
- data/lib/merb/vendor/paginator/paginator.rb +121 -0
- data/lib/mutex_hotfix.rb +34 -0
- metadata +41 -63
- data/doc/rdoc/classes/ControllerMixin.html +0 -676
- data/doc/rdoc/classes/Hash.html +0 -148
- data/doc/rdoc/classes/Merb.html +0 -140
- data/doc/rdoc/classes/Merb/Controller.html +0 -338
- data/doc/rdoc/classes/Merb/RouteMatcher.html +0 -388
- data/doc/rdoc/classes/Merb/Server.html +0 -148
- data/doc/rdoc/classes/Merb/Session.html +0 -201
- data/doc/rdoc/classes/Merb/SessionMixin.html +0 -199
- data/doc/rdoc/classes/MerbControllerError.html +0 -111
- data/doc/rdoc/classes/MerbHandler.html +0 -430
- data/doc/rdoc/classes/MerbHash.html +0 -469
- data/doc/rdoc/classes/MerbHash/Mutex.html +0 -198
- data/doc/rdoc/classes/Noroutefound.html +0 -153
- data/doc/rdoc/classes/Object.html +0 -149
- data/doc/rdoc/classes/RenderMixin.html +0 -362
- data/doc/rdoc/classes/String.html +0 -212
- data/doc/rdoc/classes/Symbol.html +0 -179
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/LICENSE.html +0 -129
- data/doc/rdoc/files/README.html +0 -417
- data/doc/rdoc/files/TODO.html +0 -151
- data/doc/rdoc/files/lib/merb/merb_class_extensions_rb.html +0 -101
- data/doc/rdoc/files/lib/merb/merb_controller_rb.html +0 -101
- data/doc/rdoc/files/lib/merb/merb_handler_rb.html +0 -101
- data/doc/rdoc/files/lib/merb/merb_router_rb.html +0 -101
- data/doc/rdoc/files/lib/merb/merb_utils_rb.html +0 -108
- data/doc/rdoc/files/lib/merb/mixins/controller_mixin_rb.html +0 -101
- data/doc/rdoc/files/lib/merb/mixins/render_mixin_rb.html +0 -101
- data/doc/rdoc/files/lib/merb/session/merb_session_rb.html +0 -101
- data/doc/rdoc/files/lib/merb_rb.html +0 -140
- data/doc/rdoc/files/lib/merb_tasks_rb.html +0 -101
- data/doc/rdoc/fr_class_index.html +0 -43
- data/doc/rdoc/fr_file_index.html +0 -40
- data/doc/rdoc/fr_method_index.html +0 -104
- data/doc/rdoc/index.html +0 -24
- data/doc/rdoc/rdoc-style.css +0 -208
- data/examples/sample_app/dist/app/controllers/upload.rb +0 -29
- data/examples/sample_app/dist/app/views/posts/comment.merbjs +0 -1
- data/examples/sample_app/dist/app/views/upload/start.rhtml +0 -15
- data/examples/sample_app/dist/app/views/upload/upload.rhtml +0 -4
- data/examples/sample_app/dist/public/files/README +0 -35
- data/examples/sample_app/dist/public/files/setup.rb +0 -1346
- data/examples/sample_app/log/merb.log +0 -778
|
@@ -1,362 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
-
<!DOCTYPE html
|
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
-
|
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
-
<head>
|
|
8
|
-
<title>Module: RenderMixin</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>Module</strong></td>
|
|
53
|
-
<td class="class-name-in-header">RenderMixin</td>
|
|
54
|
-
</tr>
|
|
55
|
-
<tr class="top-aligned-row">
|
|
56
|
-
<td><strong>In:</strong></td>
|
|
57
|
-
<td>
|
|
58
|
-
<a href="../files/lib/merb/mixins/render_mixin_rb.html">
|
|
59
|
-
lib/merb/mixins/render_mixin.rb
|
|
60
|
-
</a>
|
|
61
|
-
<br />
|
|
62
|
-
</td>
|
|
63
|
-
</tr>
|
|
64
|
-
|
|
65
|
-
</table>
|
|
66
|
-
</div>
|
|
67
|
-
<!-- banner header -->
|
|
68
|
-
|
|
69
|
-
<div id="bodyContent">
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
<div id="contextContent">
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
</div>
|
|
78
|
-
|
|
79
|
-
<div id="method-list">
|
|
80
|
-
<h3 class="section-bar">Methods</h3>
|
|
81
|
-
|
|
82
|
-
<div class="name-list">
|
|
83
|
-
<a href="#M000031">current_method_name</a>
|
|
84
|
-
<a href="#M000033">layout</a>
|
|
85
|
-
<a href="#M000036">partial</a>
|
|
86
|
-
<a href="#M000037">render</a>
|
|
87
|
-
<a href="#M000032">render_js</a>
|
|
88
|
-
<a href="#M000035">render_no_layout</a>
|
|
89
|
-
<a href="#M000034">render_nothing</a>
|
|
90
|
-
<a href="#M000030">template_dir</a>
|
|
91
|
-
</div>
|
|
92
|
-
</div>
|
|
93
|
-
|
|
94
|
-
</div>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
<!-- if includes -->
|
|
98
|
-
|
|
99
|
-
<div id="section">
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
<!-- if method_list -->
|
|
109
|
-
<div id="methods">
|
|
110
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
|
111
|
-
|
|
112
|
-
<div id="method-M000031" class="method-detail">
|
|
113
|
-
<a name="M000031"></a>
|
|
114
|
-
|
|
115
|
-
<div class="method-heading">
|
|
116
|
-
<a href="#M000031" class="method-signature">
|
|
117
|
-
<span class="method-name">current_method_name</span><span class="method-args">(depth=0)</span>
|
|
118
|
-
</a>
|
|
119
|
-
</div>
|
|
120
|
-
|
|
121
|
-
<div class="method-description">
|
|
122
|
-
<p>
|
|
123
|
-
returns the current method name. Used for auto discovery of which template
|
|
124
|
-
to <a href="RenderMixin.html#M000037">render</a> based on the action name.
|
|
125
|
-
</p>
|
|
126
|
-
<p><a class="source-toggle" href="#"
|
|
127
|
-
onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
|
|
128
|
-
<div class="method-source-code" id="M000031-source">
|
|
129
|
-
<pre>
|
|
130
|
-
<span class="ruby-comment cmt"># File lib/merb/mixins/render_mixin.rb, line 11</span>
|
|
131
|
-
11: <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>)
|
|
132
|
-
12: <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>
|
|
133
|
-
13: <span class="ruby-keyword kw">end</span>
|
|
134
|
-
</pre>
|
|
135
|
-
</div>
|
|
136
|
-
</div>
|
|
137
|
-
</div>
|
|
138
|
-
|
|
139
|
-
<div id="method-M000033" class="method-detail">
|
|
140
|
-
<a name="M000033"></a>
|
|
141
|
-
|
|
142
|
-
<div class="method-heading">
|
|
143
|
-
<a href="#M000033" class="method-signature">
|
|
144
|
-
<span class="method-name">layout</span><span class="method-args">(l)</span>
|
|
145
|
-
</a>
|
|
146
|
-
</div>
|
|
147
|
-
|
|
148
|
-
<div class="method-description">
|
|
149
|
-
<p>
|
|
150
|
-
set the @<a href="RenderMixin.html#M000033">layout</a>. Use this right
|
|
151
|
-
before a <a href="RenderMixin.html#M000037">render</a> to set the name of
|
|
152
|
-
the <a href="RenderMixin.html#M000033">layout</a> to use minus the .rhtml
|
|
153
|
-
</p>
|
|
154
|
-
<p><a class="source-toggle" href="#"
|
|
155
|
-
onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
|
|
156
|
-
<div class="method-source-code" id="M000033-source">
|
|
157
|
-
<pre>
|
|
158
|
-
<span class="ruby-comment cmt"># File lib/merb/mixins/render_mixin.rb, line 27</span>
|
|
159
|
-
27: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">layout</span>(<span class="ruby-identifier">l</span>)
|
|
160
|
-
28: <span class="ruby-ivar">@layout</span> = <span class="ruby-identifier">l</span>
|
|
161
|
-
29: <span class="ruby-keyword kw">end</span>
|
|
162
|
-
</pre>
|
|
163
|
-
</div>
|
|
164
|
-
</div>
|
|
165
|
-
</div>
|
|
166
|
-
|
|
167
|
-
<div id="method-M000036" class="method-detail">
|
|
168
|
-
<a name="M000036"></a>
|
|
169
|
-
|
|
170
|
-
<div class="method-heading">
|
|
171
|
-
<a href="#M000036" class="method-signature">
|
|
172
|
-
<span class="method-name">partial</span><span class="method-args">(template)</span>
|
|
173
|
-
</a>
|
|
174
|
-
</div>
|
|
175
|
-
|
|
176
|
-
<div class="method-description">
|
|
177
|
-
<p><a class="source-toggle" href="#"
|
|
178
|
-
onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
|
|
179
|
-
<div class="method-source-code" id="M000036-source">
|
|
180
|
-
<pre>
|
|
181
|
-
<span class="ruby-comment cmt"># File lib/merb/mixins/render_mixin.rb, line 42</span>
|
|
182
|
-
42: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">partial</span>(<span class="ruby-identifier">template</span>)
|
|
183
|
-
43: <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> ) )
|
|
184
|
-
44: <span class="ruby-identifier">template</span>.<span class="ruby-identifier">result</span>(<span class="ruby-identifier">binding</span>)
|
|
185
|
-
45: <span class="ruby-keyword kw">end</span>
|
|
186
|
-
</pre>
|
|
187
|
-
</div>
|
|
188
|
-
</div>
|
|
189
|
-
</div>
|
|
190
|
-
|
|
191
|
-
<div id="method-M000037" class="method-detail">
|
|
192
|
-
<a name="M000037"></a>
|
|
193
|
-
|
|
194
|
-
<div class="method-heading">
|
|
195
|
-
<a href="#M000037" class="method-signature">
|
|
196
|
-
<span class="method-name">render</span><span class="method-args">(template=current_method_name(1), b=binding)</span>
|
|
197
|
-
</a>
|
|
198
|
-
</div>
|
|
199
|
-
|
|
200
|
-
<div class="method-description">
|
|
201
|
-
<p>
|
|
202
|
-
renders a template based on the current action name you can pass the name
|
|
203
|
-
of a template if you want to <a href="RenderMixin.html#M000037">render</a>
|
|
204
|
-
a template with a different name then then current action name. Wraps the
|
|
205
|
-
rendered template in the <a href="RenderMixin.html#M000033">layout</a>.
|
|
206
|
-
Uses layout/application.rhtml unless there is a <a
|
|
207
|
-
href="RenderMixin.html#M000033">layout</a> named after the current
|
|
208
|
-
controller or @<a href="RenderMixin.html#M000033">layout</a> has been set
|
|
209
|
-
to another value.
|
|
210
|
-
</p>
|
|
211
|
-
<p><a class="source-toggle" href="#"
|
|
212
|
-
onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
|
|
213
|
-
<div class="method-source-code" id="M000037-source">
|
|
214
|
-
<pre>
|
|
215
|
-
<span class="ruby-comment cmt"># File lib/merb/mixins/render_mixin.rb, line 54</span>
|
|
216
|
-
54: <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>)
|
|
217
|
-
55: <span class="ruby-constant">MERB_LOGGER</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">"Rendering template: #{template_dir(template)}"</span>)
|
|
218
|
-
56: <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>
|
|
219
|
-
57: <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> ) )
|
|
220
|
-
58: <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>)
|
|
221
|
-
59: <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>)
|
|
222
|
-
60: <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>)
|
|
223
|
-
61: <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>))
|
|
224
|
-
62: <span class="ruby-identifier">layout</span> = <span class="ruby-identifier">name</span>
|
|
225
|
-
63: <span class="ruby-keyword kw">else</span>
|
|
226
|
-
64: <span class="ruby-identifier">layout</span> = <span class="ruby-value str">'application'</span>
|
|
227
|
-
65: <span class="ruby-keyword kw">end</span>
|
|
228
|
-
66: <span class="ruby-keyword kw">else</span>
|
|
229
|
-
67: <span class="ruby-identifier">layout</span> = <span class="ruby-ivar">@layout</span>.<span class="ruby-identifier">to_s</span>
|
|
230
|
-
68: <span class="ruby-keyword kw">end</span>
|
|
231
|
-
69: <span class="ruby-constant">MERB_LOGGER</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">"With Layout: #{template_dir('layout')}/#{layout}.rhtml"</span>)
|
|
232
|
-
70: <span class="ruby-ivar">@layout_content</span> = <span class="ruby-identifier">layout_content</span>
|
|
233
|
-
71: <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> ) )
|
|
234
|
-
72: <span class="ruby-identifier">layout_tmpl</span>.<span class="ruby-identifier">result</span>(<span class="ruby-identifier">b</span>)
|
|
235
|
-
73: <span class="ruby-keyword kw">end</span>
|
|
236
|
-
</pre>
|
|
237
|
-
</div>
|
|
238
|
-
</div>
|
|
239
|
-
</div>
|
|
240
|
-
|
|
241
|
-
<div id="method-M000032" class="method-detail">
|
|
242
|
-
<a name="M000032"></a>
|
|
243
|
-
|
|
244
|
-
<div class="method-heading">
|
|
245
|
-
<a href="#M000032" class="method-signature">
|
|
246
|
-
<span class="method-name">render_js</span><span class="method-args">(template=current_method_name(1), b=binding)</span>
|
|
247
|
-
</a>
|
|
248
|
-
</div>
|
|
249
|
-
|
|
250
|
-
<div class="method-description">
|
|
251
|
-
<p>
|
|
252
|
-
does a <a href="RenderMixin.html#M000037">render</a> with no <a
|
|
253
|
-
href="RenderMixin.html#M000033">layout</a>. Also sets the content type
|
|
254
|
-
header to text/javascript and escapes the template for javascript eval on
|
|
255
|
-
the client
|
|
256
|
-
</p>
|
|
257
|
-
<p><a class="source-toggle" href="#"
|
|
258
|
-
onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
|
|
259
|
-
<div class="method-source-code" id="M000032-source">
|
|
260
|
-
<pre>
|
|
261
|
-
<span class="ruby-comment cmt"># File lib/merb/mixins/render_mixin.rb, line 19</span>
|
|
262
|
-
19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render_js</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>)
|
|
263
|
-
20: <span class="ruby-identifier">headers</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-value str">"text/javascript"</span>
|
|
264
|
-
21: <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}.merbjs"</span> ))
|
|
265
|
-
22: <span class="ruby-identifier">template</span>.<span class="ruby-identifier">result</span>(<span class="ruby-identifier">b</span>)
|
|
266
|
-
23: <span class="ruby-keyword kw">end</span>
|
|
267
|
-
</pre>
|
|
268
|
-
</div>
|
|
269
|
-
</div>
|
|
270
|
-
</div>
|
|
271
|
-
|
|
272
|
-
<div id="method-M000035" class="method-detail">
|
|
273
|
-
<a name="M000035"></a>
|
|
274
|
-
|
|
275
|
-
<div class="method-heading">
|
|
276
|
-
<a href="#M000035" class="method-signature">
|
|
277
|
-
<span class="method-name">render_no_layout</span><span class="method-args">(template=current_method_name(1), b=binding)</span>
|
|
278
|
-
</a>
|
|
279
|
-
</div>
|
|
280
|
-
|
|
281
|
-
<div class="method-description">
|
|
282
|
-
<p>
|
|
283
|
-
renders the action without wrapping it in a <a
|
|
284
|
-
href="RenderMixin.html#M000033">layout</a>.
|
|
285
|
-
</p>
|
|
286
|
-
<p><a class="source-toggle" href="#"
|
|
287
|
-
onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
|
|
288
|
-
<div class="method-source-code" id="M000035-source">
|
|
289
|
-
<pre>
|
|
290
|
-
<span class="ruby-comment cmt"># File lib/merb/mixins/render_mixin.rb, line 37</span>
|
|
291
|
-
37: <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>)
|
|
292
|
-
38: <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> ) )
|
|
293
|
-
39: <span class="ruby-identifier">template</span>.<span class="ruby-identifier">result</span>(<span class="ruby-identifier">b</span>)
|
|
294
|
-
40: <span class="ruby-keyword kw">end</span>
|
|
295
|
-
</pre>
|
|
296
|
-
</div>
|
|
297
|
-
</div>
|
|
298
|
-
</div>
|
|
299
|
-
|
|
300
|
-
<div id="method-M000034" class="method-detail">
|
|
301
|
-
<a name="M000034"></a>
|
|
302
|
-
|
|
303
|
-
<div class="method-heading">
|
|
304
|
-
<a href="#M000034" class="method-signature">
|
|
305
|
-
<span class="method-name">render_nothing</span><span class="method-args">(status)</span>
|
|
306
|
-
</a>
|
|
307
|
-
</div>
|
|
308
|
-
|
|
309
|
-
<div class="method-description">
|
|
310
|
-
<p><a class="source-toggle" href="#"
|
|
311
|
-
onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
|
|
312
|
-
<div class="method-source-code" id="M000034-source">
|
|
313
|
-
<pre>
|
|
314
|
-
<span class="ruby-comment cmt"># File lib/merb/mixins/render_mixin.rb, line 31</span>
|
|
315
|
-
31: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render_nothing</span>(<span class="ruby-identifier">status</span>)
|
|
316
|
-
32: <span class="ruby-ivar">@status</span> = <span class="ruby-identifier">status</span>
|
|
317
|
-
33: <span class="ruby-keyword kw">return</span> <span class="ruby-value str">''</span>
|
|
318
|
-
34: <span class="ruby-keyword kw">end</span>
|
|
319
|
-
</pre>
|
|
320
|
-
</div>
|
|
321
|
-
</div>
|
|
322
|
-
</div>
|
|
323
|
-
|
|
324
|
-
<div id="method-M000030" class="method-detail">
|
|
325
|
-
<a name="M000030"></a>
|
|
326
|
-
|
|
327
|
-
<div class="method-heading">
|
|
328
|
-
<a href="#M000030" class="method-signature">
|
|
329
|
-
<span class="method-name">template_dir</span><span class="method-args">(loc)</span>
|
|
330
|
-
</a>
|
|
331
|
-
</div>
|
|
332
|
-
|
|
333
|
-
<div class="method-description">
|
|
334
|
-
<p>
|
|
335
|
-
shortcut to a template path based on name.
|
|
336
|
-
</p>
|
|
337
|
-
<p><a class="source-toggle" href="#"
|
|
338
|
-
onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
|
|
339
|
-
<div class="method-source-code" id="M000030-source">
|
|
340
|
-
<pre>
|
|
341
|
-
<span class="ruby-comment cmt"># File lib/merb/mixins/render_mixin.rb, line 4</span>
|
|
342
|
-
4: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">template_dir</span>(<span class="ruby-identifier">loc</span>)
|
|
343
|
-
5: <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>)
|
|
344
|
-
6: <span class="ruby-keyword kw">end</span>
|
|
345
|
-
</pre>
|
|
346
|
-
</div>
|
|
347
|
-
</div>
|
|
348
|
-
</div>
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
</div>
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
</div>
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
<div id="validator-badges">
|
|
358
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
359
|
-
</div>
|
|
360
|
-
|
|
361
|
-
</body>
|
|
362
|
-
</html>
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
-
<!DOCTYPE html
|
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
-
|
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
-
<head>
|
|
8
|
-
<title>Class: String</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">String</td>
|
|
54
|
-
</tr>
|
|
55
|
-
<tr class="top-aligned-row">
|
|
56
|
-
<td><strong>In:</strong></td>
|
|
57
|
-
<td>
|
|
58
|
-
<a href="../files/lib/merb/merb_utils_rb.html">
|
|
59
|
-
lib/merb/merb_utils.rb
|
|
60
|
-
</a>
|
|
61
|
-
<br />
|
|
62
|
-
</td>
|
|
63
|
-
</tr>
|
|
64
|
-
|
|
65
|
-
<tr class="top-aligned-row">
|
|
66
|
-
<td><strong>Parent:</strong></td>
|
|
67
|
-
<td>
|
|
68
|
-
<a href="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
|
-
|
|
84
|
-
|
|
85
|
-
</div>
|
|
86
|
-
|
|
87
|
-
<div id="method-list">
|
|
88
|
-
<h3 class="section-bar">Methods</h3>
|
|
89
|
-
|
|
90
|
-
<div class="name-list">
|
|
91
|
-
<a href="#M000029">camel_case</a>
|
|
92
|
-
<a href="#M000027">import</a>
|
|
93
|
-
<a href="#M000028">snake_case</a>
|
|
94
|
-
</div>
|
|
95
|
-
</div>
|
|
96
|
-
|
|
97
|
-
</div>
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
<!-- if includes -->
|
|
101
|
-
|
|
102
|
-
<div id="section">
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
<!-- if method_list -->
|
|
112
|
-
<div id="methods">
|
|
113
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
|
114
|
-
|
|
115
|
-
<div id="method-M000029" class="method-detail">
|
|
116
|
-
<a name="M000029"></a>
|
|
117
|
-
|
|
118
|
-
<div class="method-heading">
|
|
119
|
-
<a href="#M000029" class="method-signature">
|
|
120
|
-
<span class="method-name">camel_case</span><span class="method-args">()</span>
|
|
121
|
-
</a>
|
|
122
|
-
</div>
|
|
123
|
-
|
|
124
|
-
<div class="method-description">
|
|
125
|
-
<p>
|
|
126
|
-
"foo_bar".<a href="String.html#M000029">camel_case</a> #=>
|
|
127
|
-
"FooBar"
|
|
128
|
-
</p>
|
|
129
|
-
<p><a class="source-toggle" href="#"
|
|
130
|
-
onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
|
|
131
|
-
<div class="method-source-code" id="M000029-source">
|
|
132
|
-
<pre>
|
|
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>
|
|
140
|
-
</pre>
|
|
141
|
-
</div>
|
|
142
|
-
</div>
|
|
143
|
-
</div>
|
|
144
|
-
|
|
145
|
-
<div id="method-M000027" class="method-detail">
|
|
146
|
-
<a name="M000027"></a>
|
|
147
|
-
|
|
148
|
-
<div class="method-heading">
|
|
149
|
-
<a href="#M000027" class="method-signature">
|
|
150
|
-
<span class="method-name">import</span><span class="method-args">()</span>
|
|
151
|
-
</a>
|
|
152
|
-
</div>
|
|
153
|
-
|
|
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>
|
|
159
|
-
<p><a class="source-toggle" href="#"
|
|
160
|
-
onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
|
|
161
|
-
<div class="method-source-code" id="M000027-source">
|
|
162
|
-
<pre>
|
|
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>
|
|
167
|
-
</pre>
|
|
168
|
-
</div>
|
|
169
|
-
</div>
|
|
170
|
-
</div>
|
|
171
|
-
|
|
172
|
-
<div id="method-M000028" class="method-detail">
|
|
173
|
-
<a name="M000028"></a>
|
|
174
|
-
|
|
175
|
-
<div class="method-heading">
|
|
176
|
-
<a href="#M000028" class="method-signature">
|
|
177
|
-
<span class="method-name">snake_case</span><span class="method-args">()</span>
|
|
178
|
-
</a>
|
|
179
|
-
</div>
|
|
180
|
-
|
|
181
|
-
<div class="method-description">
|
|
182
|
-
<p>
|
|
183
|
-
"FooBar".<a href="String.html#M000028">snake_case</a> #=>
|
|
184
|
-
"foo_bar"
|
|
185
|
-
</p>
|
|
186
|
-
<p><a class="source-toggle" href="#"
|
|
187
|
-
onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
|
|
188
|
-
<div class="method-source-code" id="M000028-source">
|
|
189
|
-
<pre>
|
|
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>
|
|
195
|
-
</pre>
|
|
196
|
-
</div>
|
|
197
|
-
</div>
|
|
198
|
-
</div>
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
</div>
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
</div>
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
<div id="validator-badges">
|
|
208
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
209
|
-
</div>
|
|
210
|
-
|
|
211
|
-
</body>
|
|
212
|
-
</html>
|