Capcode 0.8.9 → 0.9.0
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.rdoc +13 -1
- data/doc/rdoc/classes/Capcode.html +410 -545
- data/doc/rdoc/classes/Capcode/Configuration.html +263 -0
- data/doc/rdoc/classes/Capcode/Helpers.html +154 -345
- data/doc/rdoc/classes/Capcode/Helpers/Authorization.html +6 -6
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README_rdoc.html +42 -2
- data/doc/rdoc/files/lib/capcode/configuration_rb.html +1 -1
- data/doc/rdoc/files/lib/capcode/render/text_rb.html +1 -1
- data/doc/rdoc/files/lib/capcode_rb.html +14 -1
- data/doc/rdoc/fr_class_index.html +1 -1
- data/doc/rdoc/fr_file_index.html +0 -13
- data/doc/rdoc/fr_method_index.html +12 -14
- data/examples/render-image.rb +1 -1
- data/examples/render-text.rb +4 -1
- data/examples/rest.rb +1 -0
- data/examples/sample.rb +5 -3
- data/examples/upload.rb +1 -0
- data/lib/capcode.rb +45 -61
- data/lib/capcode/configuration.rb +69 -34
- data/lib/capcode/render/text.rb +1 -1
- data/lib/capcode/version.rb +1 -1
- metadata +31 -106
- data/doc/rdoc/classes/Capcode/Mab.html +0 -118
- data/doc/rdoc/files/lib/capcode/render/binary_rb.html +0 -101
- data/doc/rdoc/files/lib/capcode/render/email_rb.html +0 -108
- data/doc/rdoc/files/lib/capcode/render/erb_rb.html +0 -108
- data/doc/rdoc/files/lib/capcode/render/haml_rb.html +0 -108
- data/doc/rdoc/files/lib/capcode/render/json_rb.html +0 -108
- data/doc/rdoc/files/lib/capcode/render/markaby_rb.html +0 -108
- data/doc/rdoc/files/lib/capcode/render/mustache_rb.html +0 -108
- data/doc/rdoc/files/lib/capcode/render/none_rb.html +0 -101
- data/doc/rdoc/files/lib/capcode/render/redirect_rb.html +0 -101
- data/doc/rdoc/files/lib/capcode/render/sass_rb.html +0 -108
- data/doc/rdoc/files/lib/capcode/render/static_rb.html +0 -101
- data/doc/rdoc/files/lib/capcode/render/webdav_rb.html +0 -124
- data/doc/rdoc/files/lib/capcode/render/xml_rb.html +0 -101
- data/examples/auth-webdav.rb +0 -29
- data/examples/blog-ar.rb +0 -81
- data/examples/blog-ar.yml +0 -3
- data/examples/blog-couchdb-run.rb +0 -10
- data/examples/blog-couchdb.rb +0 -314
- data/examples/blog-couchdb.ru +0 -12
- data/examples/blog-couchdb.yml +0 -2
- data/examples/blog-dm.rb +0 -63
- data/examples/blog-dm.yml +0 -2
- data/examples/blog-mongodb-run.rb +0 -10
- data/examples/blog-mongodb.rb +0 -304
- data/examples/blog-mongodb.yml +0 -3
- data/examples/blog-sq.rb +0 -82
- data/examples/blog-sq.yml +0 -3
- data/examples/mail/mail_html.rhtml +0 -1
- data/examples/mail/mail_text.rhtml +0 -1
- data/examples/mail/ok.rhtml +0 -1
- data/examples/mail/rubyfr.png +0 -0
- data/examples/mustache/with_class.mustache +0 -8
- data/examples/mustache/without_class.mustache +0 -1
- data/examples/render-binary.rb +0 -46
- data/examples/render-email.rb +0 -68
- data/examples/render-erb.rb +0 -19
- data/examples/render-haml_sass.rb +0 -26
- data/examples/render-json.rb +0 -13
- data/examples/render-markaby.rb +0 -29
- data/examples/render-mustache.rb +0 -30
- data/examples/render-redirect.rb +0 -19
- data/examples/render-static.rb +0 -21
- data/examples/render-static.ru +0 -19
- data/examples/render-use.rb +0 -32
- data/examples/render-webdav.rb +0 -26
- data/examples/render-xml.rb +0 -24
- data/examples/rss.rb +0 -48
- data/examples/static/coderay.css +0 -131
- data/examples/static/index.html +0 -24
- data/examples/test/index.html +0 -1
- data/lib/capcode/base/ar.rb +0 -54
- data/lib/capcode/base/couchdb.rb +0 -23
- data/lib/capcode/base/dm.rb +0 -33
- data/lib/capcode/base/mongodb.rb +0 -27
- data/lib/capcode/base/sq.rb +0 -58
- data/lib/capcode/render/binary.rb +0 -8
- data/lib/capcode/render/email.rb +0 -73
- data/lib/capcode/render/erb.rb +0 -59
- data/lib/capcode/render/haml.rb +0 -60
- data/lib/capcode/render/json.rb +0 -14
- data/lib/capcode/render/markaby.rb +0 -38
- data/lib/capcode/render/mustache.rb +0 -37
- data/lib/capcode/render/none.rb +0 -7
- data/lib/capcode/render/redirect.rb +0 -7
- data/lib/capcode/render/sass.rb +0 -48
- data/lib/capcode/render/static.rb +0 -14
- data/lib/capcode/render/webdav.rb +0 -49
- data/lib/capcode/render/xml.rb +0 -119
@@ -0,0 +1,263 @@
|
|
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: Capcode::Configuration</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">Capcode::Configuration</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/capcode/configuration_rb.html">
|
59
|
+
lib/capcode/configuration.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
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000023">get</a>
|
90
|
+
<a href="#M000024">options</a>
|
91
|
+
<a href="#M000022">set</a>
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
|
98
|
+
<!-- if includes -->
|
99
|
+
|
100
|
+
<div id="section">
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<!-- if method_list -->
|
110
|
+
<div id="methods">
|
111
|
+
<h3 class="section-bar">Public Class methods</h3>
|
112
|
+
|
113
|
+
<div id="method-M000023" class="method-detail">
|
114
|
+
<a name="M000023"></a>
|
115
|
+
|
116
|
+
<div class="method-heading">
|
117
|
+
<a href="#M000023" class="method-signature">
|
118
|
+
<span class="method-name">get</span><span class="method-args">( key = nil )</span>
|
119
|
+
</a>
|
120
|
+
</div>
|
121
|
+
|
122
|
+
<div class="method-description">
|
123
|
+
<p><a class="source-toggle" href="#"
|
124
|
+
onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
|
125
|
+
<div class="method-source-code" id="M000023-source">
|
126
|
+
<pre>
|
127
|
+
<span class="ruby-comment cmt"># File lib/capcode/configuration.rb, line 61</span>
|
128
|
+
61: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get</span>( <span class="ruby-identifier">key</span> = <span class="ruby-keyword kw">nil</span> )
|
129
|
+
62: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">nil?</span>
|
130
|
+
63: <span class="ruby-identifier">config</span>
|
131
|
+
64: <span class="ruby-keyword kw">else</span>
|
132
|
+
65: <span class="ruby-identifier">config</span>[<span class="ruby-identifier">key</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword kw">nil</span>
|
133
|
+
66: <span class="ruby-keyword kw">end</span>
|
134
|
+
67: <span class="ruby-keyword kw">end</span>
|
135
|
+
</pre>
|
136
|
+
</div>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
<div id="method-M000024" class="method-detail">
|
141
|
+
<a name="M000024"></a>
|
142
|
+
|
143
|
+
<div class="method-heading">
|
144
|
+
<a href="#M000024" class="method-signature">
|
145
|
+
<span class="method-name">options</span><span class="method-args">()</span>
|
146
|
+
</a>
|
147
|
+
</div>
|
148
|
+
|
149
|
+
<div class="method-description">
|
150
|
+
<p><a class="source-toggle" href="#"
|
151
|
+
onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
|
152
|
+
<div class="method-source-code" id="M000024-source">
|
153
|
+
<pre>
|
154
|
+
<span class="ruby-comment cmt"># File lib/capcode/configuration.rb, line 69</span>
|
155
|
+
69: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">options</span>
|
156
|
+
70: <span class="ruby-ivar">@options</span> <span class="ruby-operator">||=</span> {}
|
157
|
+
71: <span class="ruby-keyword kw">end</span>
|
158
|
+
</pre>
|
159
|
+
</div>
|
160
|
+
</div>
|
161
|
+
</div>
|
162
|
+
|
163
|
+
<div id="method-M000022" class="method-detail">
|
164
|
+
<a name="M000022"></a>
|
165
|
+
|
166
|
+
<div class="method-heading">
|
167
|
+
<a href="#M000022" class="method-signature">
|
168
|
+
<span class="method-name">set</span><span class="method-args">( key, value, opts = {} )</span>
|
169
|
+
</a>
|
170
|
+
</div>
|
171
|
+
|
172
|
+
<div class="method-description">
|
173
|
+
<p>
|
174
|
+
Set global configuration <a href="Configuration.html#M000024">options</a>
|
175
|
+
</p>
|
176
|
+
<p>
|
177
|
+
Options :
|
178
|
+
</p>
|
179
|
+
<ul>
|
180
|
+
<li><tt>:port</tt> = Listen port (default: 3000)
|
181
|
+
|
182
|
+
</li>
|
183
|
+
<li><tt>:host</tt> = Listen host (default: 0.0.0.0)
|
184
|
+
|
185
|
+
</li>
|
186
|
+
<li><tt>:server</tt> = Server type (webrick, mongrel or thin)
|
187
|
+
|
188
|
+
</li>
|
189
|
+
<li><tt>:log</tt> = Output logfile (default: STDOUT)
|
190
|
+
|
191
|
+
</li>
|
192
|
+
<li><tt>:session</tt> = Session parameters. See Rack::Session for more
|
193
|
+
informations
|
194
|
+
|
195
|
+
</li>
|
196
|
+
<li><tt>:pid</tt> = PID file (default: $0.pid)
|
197
|
+
|
198
|
+
</li>
|
199
|
+
<li><tt>:daemonize</tt> = Daemonize application (default: false)
|
200
|
+
|
201
|
+
</li>
|
202
|
+
<li><tt>:db_config</tt> = database configuration file (default: database.yml)
|
203
|
+
|
204
|
+
</li>
|
205
|
+
<li><tt>:static</tt> = Static directory (default: the working directory)
|
206
|
+
|
207
|
+
</li>
|
208
|
+
<li><tt>:root</tt> = Root directory (default: directory of the main.rb) —
|
209
|
+
This is also the working directory !
|
210
|
+
|
211
|
+
</li>
|
212
|
+
<li><tt>:verbose</tt> = run in verbose mode
|
213
|
+
|
214
|
+
</li>
|
215
|
+
<li><tt>:auth</tt> = HTTP Basic Authentication <a
|
216
|
+
href="Configuration.html#M000024">options</a>
|
217
|
+
|
218
|
+
</li>
|
219
|
+
</ul>
|
220
|
+
<p>
|
221
|
+
It can exist specifics <a href="Configuration.html#M000024">options</a>
|
222
|
+
depending on a renderer, a helper, …
|
223
|
+
</p>
|
224
|
+
<p>
|
225
|
+
Example :
|
226
|
+
</p>
|
227
|
+
<pre>
|
228
|
+
module Capcode
|
229
|
+
set :erb, "/path/to/erb/files"
|
230
|
+
...
|
231
|
+
end
|
232
|
+
</pre>
|
233
|
+
<p><a class="source-toggle" href="#"
|
234
|
+
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
235
|
+
<div class="method-source-code" id="M000022-source">
|
236
|
+
<pre>
|
237
|
+
<span class="ruby-comment cmt"># File lib/capcode/configuration.rb, line 52</span>
|
238
|
+
52: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set</span>( <span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">opts</span> = {} )
|
239
|
+
53: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Hash</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">value</span>
|
240
|
+
54: <span class="ruby-identifier">opts</span> = <span class="ruby-identifier">value</span>
|
241
|
+
55: <span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">nil</span>
|
242
|
+
56: <span class="ruby-keyword kw">end</span>
|
243
|
+
57: <span class="ruby-identifier">config</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span>
|
244
|
+
58: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">opts</span>
|
245
|
+
59: <span class="ruby-keyword kw">end</span>
|
246
|
+
</pre>
|
247
|
+
</div>
|
248
|
+
</div>
|
249
|
+
</div>
|
250
|
+
|
251
|
+
|
252
|
+
</div>
|
253
|
+
|
254
|
+
|
255
|
+
</div>
|
256
|
+
|
257
|
+
|
258
|
+
<div id="validator-badges">
|
259
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
260
|
+
</div>
|
261
|
+
|
262
|
+
</body>
|
263
|
+
</html>
|
@@ -58,62 +58,10 @@
|
|
58
58
|
<a href="../../files/lib/capcode_rb.html">
|
59
59
|
lib/capcode.rb
|
60
60
|
</a>
|
61
|
-
<br />
|
62
|
-
<a href="../../files/lib/capcode/render/binary_rb.html">
|
63
|
-
lib/capcode/render/binary.rb
|
64
|
-
</a>
|
65
|
-
<br />
|
66
|
-
<a href="../../files/lib/capcode/render/email_rb.html">
|
67
|
-
lib/capcode/render/email.rb
|
68
|
-
</a>
|
69
|
-
<br />
|
70
|
-
<a href="../../files/lib/capcode/render/erb_rb.html">
|
71
|
-
lib/capcode/render/erb.rb
|
72
|
-
</a>
|
73
|
-
<br />
|
74
|
-
<a href="../../files/lib/capcode/render/haml_rb.html">
|
75
|
-
lib/capcode/render/haml.rb
|
76
|
-
</a>
|
77
|
-
<br />
|
78
|
-
<a href="../../files/lib/capcode/render/json_rb.html">
|
79
|
-
lib/capcode/render/json.rb
|
80
|
-
</a>
|
81
|
-
<br />
|
82
|
-
<a href="../../files/lib/capcode/render/markaby_rb.html">
|
83
|
-
lib/capcode/render/markaby.rb
|
84
|
-
</a>
|
85
|
-
<br />
|
86
|
-
<a href="../../files/lib/capcode/render/mustache_rb.html">
|
87
|
-
lib/capcode/render/mustache.rb
|
88
|
-
</a>
|
89
|
-
<br />
|
90
|
-
<a href="../../files/lib/capcode/render/none_rb.html">
|
91
|
-
lib/capcode/render/none.rb
|
92
|
-
</a>
|
93
|
-
<br />
|
94
|
-
<a href="../../files/lib/capcode/render/redirect_rb.html">
|
95
|
-
lib/capcode/render/redirect.rb
|
96
|
-
</a>
|
97
|
-
<br />
|
98
|
-
<a href="../../files/lib/capcode/render/sass_rb.html">
|
99
|
-
lib/capcode/render/sass.rb
|
100
|
-
</a>
|
101
|
-
<br />
|
102
|
-
<a href="../../files/lib/capcode/render/static_rb.html">
|
103
|
-
lib/capcode/render/static.rb
|
104
|
-
</a>
|
105
61
|
<br />
|
106
62
|
<a href="../../files/lib/capcode/render/text_rb.html">
|
107
63
|
lib/capcode/render/text.rb
|
108
64
|
</a>
|
109
|
-
<br />
|
110
|
-
<a href="../../files/lib/capcode/render/webdav_rb.html">
|
111
|
-
lib/capcode/render/webdav.rb
|
112
|
-
</a>
|
113
|
-
<br />
|
114
|
-
<a href="../../files/lib/capcode/render/xml_rb.html">
|
115
|
-
lib/capcode/render/xml.rb
|
116
|
-
</a>
|
117
65
|
<br />
|
118
66
|
<a href="../../files/lib/capcode/helpers/auth_rb.html">
|
119
67
|
lib/capcode/helpers/auth.rb
|
@@ -147,18 +95,14 @@ controllers
|
|
147
95
|
<h3 class="section-bar">Methods</h3>
|
148
96
|
|
149
97
|
<div class="name-list">
|
150
|
-
<a href="#
|
151
|
-
<a href="#
|
152
|
-
<a href="#
|
153
|
-
<a href="#
|
154
|
-
<a href="#
|
155
|
-
<a href="#
|
156
|
-
<a href="#
|
157
|
-
<a href="#
|
158
|
-
<a href="#M000016">render</a>
|
159
|
-
<a href="#M000025">render_webdav</a>
|
160
|
-
<a href="#M000024">sass_path=</a>
|
161
|
-
<a href="#M000021">static</a>
|
98
|
+
<a href="#M000018">URL</a>
|
99
|
+
<a href="#M000013">args</a>
|
100
|
+
<a href="#M000014">args=</a>
|
101
|
+
<a href="#M000019">content_for</a>
|
102
|
+
<a href="#M000016">json</a>
|
103
|
+
<a href="#M000017">redirect</a>
|
104
|
+
<a href="#M000015">render</a>
|
105
|
+
<a href="#M000020">static</a>
|
162
106
|
</div>
|
163
107
|
</div>
|
164
108
|
|
@@ -193,11 +137,11 @@ controllers
|
|
193
137
|
<div id="methods">
|
194
138
|
<h3 class="section-bar">Public Class methods</h3>
|
195
139
|
|
196
|
-
<div id="method-
|
197
|
-
<a name="
|
140
|
+
<div id="method-M000013" class="method-detail">
|
141
|
+
<a name="M000013"></a>
|
198
142
|
|
199
143
|
<div class="method-heading">
|
200
|
-
<a href="#
|
144
|
+
<a href="#M000013" class="method-signature">
|
201
145
|
<span class="method-name">args</span><span class="method-args">()</span>
|
202
146
|
</a>
|
203
147
|
</div>
|
@@ -207,126 +151,36 @@ controllers
|
|
207
151
|
@@<em>ARGS</em> = nil
|
208
152
|
</p>
|
209
153
|
<p><a class="source-toggle" href="#"
|
210
|
-
onclick="toggleCode('
|
211
|
-
<div class="method-source-code" id="
|
154
|
+
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
155
|
+
<div class="method-source-code" id="M000013-source">
|
212
156
|
<pre>
|
213
|
-
<span class="ruby-comment cmt"># File lib/capcode.rb, line
|
214
|
-
|
215
|
-
|
216
|
-
|
157
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 47</span>
|
158
|
+
47: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">args</span>
|
159
|
+
48: <span class="ruby-ivar">@args</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">nil</span>
|
160
|
+
49: <span class="ruby-keyword kw">end</span>
|
217
161
|
</pre>
|
218
162
|
</div>
|
219
163
|
</div>
|
220
164
|
</div>
|
221
165
|
|
222
|
-
<div id="method-
|
223
|
-
<a name="
|
166
|
+
<div id="method-M000014" class="method-detail">
|
167
|
+
<a name="M000014"></a>
|
224
168
|
|
225
169
|
<div class="method-heading">
|
226
|
-
<a href="#
|
170
|
+
<a href="#M000014" class="method-signature">
|
227
171
|
<span class="method-name">args=</span><span class="method-args">(x)</span>
|
228
172
|
</a>
|
229
173
|
</div>
|
230
174
|
|
231
175
|
<div class="method-description">
|
232
176
|
<p><a class="source-toggle" href="#"
|
233
|
-
onclick="toggleCode('
|
234
|
-
<div class="method-source-code" id="
|
235
|
-
<pre>
|
236
|
-
<span class="ruby-comment cmt"># File lib/capcode.rb, line 49</span>
|
237
|
-
49: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">args=</span>(<span class="ruby-identifier">x</span>)
|
238
|
-
50: <span class="ruby-ivar">@args</span> = <span class="ruby-identifier">x</span>
|
239
|
-
51: <span class="ruby-keyword kw">end</span>
|
240
|
-
</pre>
|
241
|
-
</div>
|
242
|
-
</div>
|
243
|
-
</div>
|
244
|
-
|
245
|
-
<div id="method-M000022" class="method-detail">
|
246
|
-
<a name="M000022"></a>
|
247
|
-
|
248
|
-
<div class="method-heading">
|
249
|
-
<a href="#M000022" class="method-signature">
|
250
|
-
<span class="method-name">erb_path=</span><span class="method-args">( p )</span>
|
251
|
-
</a>
|
252
|
-
</div>
|
253
|
-
|
254
|
-
<div class="method-description">
|
255
|
-
<p>
|
256
|
-
Set the path to ERB files. If this path is not set, <a
|
257
|
-
href="../Capcode.html">Capcode</a> will search in the <a
|
258
|
-
href="Helpers.html#M000021">static</a> path. This method is deprecated and
|
259
|
-
will be removed in version 1.0
|
260
|
-
</p>
|
261
|
-
<p><a class="source-toggle" href="#"
|
262
|
-
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
263
|
-
<div class="method-source-code" id="M000022-source">
|
264
|
-
<pre>
|
265
|
-
<span class="ruby-comment cmt"># File lib/capcode/render/erb.rb, line 7</span>
|
266
|
-
7: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">erb_path=</span>( <span class="ruby-identifier">p</span> )
|
267
|
-
8: <span class="ruby-identifier">warn</span> <span class="ruby-value str">"Capcode::Helpers.erb_path is deprecated and will be removed in version 1.0, please use `set :erb'"</span>
|
268
|
-
9: <span class="ruby-constant">Capcode</span>.<span class="ruby-identifier">set</span> <span class="ruby-identifier">:erb</span>, <span class="ruby-identifier">p</span>
|
269
|
-
10: <span class="ruby-keyword kw">end</span>
|
270
|
-
</pre>
|
271
|
-
</div>
|
272
|
-
</div>
|
273
|
-
</div>
|
274
|
-
|
275
|
-
<div id="method-M000023" class="method-detail">
|
276
|
-
<a name="M000023"></a>
|
277
|
-
|
278
|
-
<div class="method-heading">
|
279
|
-
<a href="#M000023" class="method-signature">
|
280
|
-
<span class="method-name">haml_path=</span><span class="method-args">( p )</span>
|
281
|
-
</a>
|
282
|
-
</div>
|
283
|
-
|
284
|
-
<div class="method-description">
|
285
|
-
<p>
|
286
|
-
Set the path to Haml files. If this path is not set, <a
|
287
|
-
href="../Capcode.html">Capcode</a> will search in the <a
|
288
|
-
href="Helpers.html#M000021">static</a> path. This method is deprecated and
|
289
|
-
will be removed in version 1.0
|
290
|
-
</p>
|
291
|
-
<p><a class="source-toggle" href="#"
|
292
|
-
onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
|
293
|
-
<div class="method-source-code" id="M000023-source">
|
294
|
-
<pre>
|
295
|
-
<span class="ruby-comment cmt"># File lib/capcode/render/haml.rb, line 11</span>
|
296
|
-
11: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">haml_path=</span>( <span class="ruby-identifier">p</span> )
|
297
|
-
12: <span class="ruby-identifier">warn</span> <span class="ruby-value str">"Capcode::Helpers.haml_path is deprecated and will be removed in version 1.0, please use `set :haml'"</span>
|
298
|
-
13: <span class="ruby-constant">Capcode</span>.<span class="ruby-identifier">set</span> <span class="ruby-identifier">:haml</span>, <span class="ruby-identifier">p</span>
|
299
|
-
14: <span class="ruby-keyword kw">end</span>
|
300
|
-
</pre>
|
301
|
-
</div>
|
302
|
-
</div>
|
303
|
-
</div>
|
304
|
-
|
305
|
-
<div id="method-M000024" class="method-detail">
|
306
|
-
<a name="M000024"></a>
|
307
|
-
|
308
|
-
<div class="method-heading">
|
309
|
-
<a href="#M000024" class="method-signature">
|
310
|
-
<span class="method-name">sass_path=</span><span class="method-args">( p )</span>
|
311
|
-
</a>
|
312
|
-
</div>
|
313
|
-
|
314
|
-
<div class="method-description">
|
315
|
-
<p>
|
316
|
-
Set the path to Sass files. If this path is not set, <a
|
317
|
-
href="../Capcode.html">Capcode</a> will search in the <a
|
318
|
-
href="Helpers.html#M000021">static</a> path. This method is deprecated and
|
319
|
-
will be removed in version 1.0
|
320
|
-
</p>
|
321
|
-
<p><a class="source-toggle" href="#"
|
322
|
-
onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
|
323
|
-
<div class="method-source-code" id="M000024-source">
|
177
|
+
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
178
|
+
<div class="method-source-code" id="M000014-source">
|
324
179
|
<pre>
|
325
|
-
<span class="ruby-comment cmt"># File lib/capcode
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
14: <span class="ruby-keyword kw">end</span>
|
180
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 50</span>
|
181
|
+
50: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">args=</span>(<span class="ruby-identifier">x</span>)
|
182
|
+
51: <span class="ruby-ivar">@args</span> = <span class="ruby-identifier">x</span>
|
183
|
+
52: <span class="ruby-keyword kw">end</span>
|
330
184
|
</pre>
|
331
185
|
</div>
|
332
186
|
</div>
|
@@ -334,18 +188,18 @@ will be removed in version 1.0
|
|
334
188
|
|
335
189
|
<h3 class="section-bar">Public Instance methods</h3>
|
336
190
|
|
337
|
-
<div id="method-
|
338
|
-
<a name="
|
191
|
+
<div id="method-M000018" class="method-detail">
|
192
|
+
<a name="M000018"></a>
|
339
193
|
|
340
194
|
<div class="method-heading">
|
341
|
-
<a href="#
|
195
|
+
<a href="#M000018" class="method-signature">
|
342
196
|
<span class="method-name">URL</span><span class="method-args">( klass, *a )</span>
|
343
197
|
</a>
|
344
198
|
</div>
|
345
199
|
|
346
200
|
<div class="method-description">
|
347
201
|
<p>
|
348
|
-
Builds an <a href="Helpers.html#
|
202
|
+
Builds an <a href="Helpers.html#M000018">URL</a> route to a controller or a
|
349
203
|
path
|
350
204
|
</p>
|
351
205
|
<p>
|
@@ -365,41 +219,41 @@ then
|
|
365
219
|
URL( Capcode::Hello, "you" ) # => /hello/you
|
366
220
|
</pre>
|
367
221
|
<p><a class="source-toggle" href="#"
|
368
|
-
onclick="toggleCode('
|
369
|
-
<div class="method-source-code" id="
|
222
|
+
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
223
|
+
<div class="method-source-code" id="M000018-source">
|
370
224
|
<pre>
|
371
|
-
<span class="ruby-comment cmt"># File lib/capcode.rb, line
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
225
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 185</span>
|
226
|
+
185: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">URL</span>( <span class="ruby-identifier">klass</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">a</span> )
|
227
|
+
186: <span class="ruby-identifier">path</span> = <span class="ruby-keyword kw">nil</span>
|
228
|
+
187: <span class="ruby-identifier">a</span> = <span class="ruby-identifier">a</span>.<span class="ruby-identifier">delete_if</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">nil?</span> }
|
229
|
+
188:
|
230
|
+
189: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Class</span>
|
231
|
+
190: <span class="ruby-constant">Capcode</span>.<span class="ruby-identifier">routes</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span>, <span class="ruby-identifier">k</span><span class="ruby-operator">|</span>
|
232
|
+
191: <span class="ruby-identifier">path</span> = <span class="ruby-identifier">p</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">k</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">klass</span>
|
233
|
+
192: <span class="ruby-keyword kw">end</span>
|
234
|
+
193: <span class="ruby-keyword kw">else</span>
|
235
|
+
194: <span class="ruby-identifier">path</span> = <span class="ruby-identifier">klass</span>
|
236
|
+
195: <span class="ruby-keyword kw">end</span>
|
237
|
+
196:
|
238
|
+
197: (<span class="ruby-constant">ENV</span>[<span class="ruby-value str">'RACK_BASE_URI'</span>]<span class="ruby-operator">||</span><span class="ruby-value str">''</span>)<span class="ruby-operator">+</span><span class="ruby-identifier">path</span><span class="ruby-operator">+</span>((<span class="ruby-identifier">a</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">></span><span class="ruby-value">0</span>)<span class="ruby-operator">?</span>(<span class="ruby-value str">"/"</span><span class="ruby-operator">+</span><span class="ruby-identifier">a</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"/"</span>))<span class="ruby-operator">:</span>(<span class="ruby-value str">""</span>))
|
239
|
+
198: <span class="ruby-keyword kw">end</span>
|
386
240
|
</pre>
|
387
241
|
</div>
|
388
242
|
</div>
|
389
243
|
</div>
|
390
244
|
|
391
|
-
<div id="method-
|
392
|
-
<a name="
|
245
|
+
<div id="method-M000019" class="method-detail">
|
246
|
+
<a name="M000019"></a>
|
393
247
|
|
394
248
|
<div class="method-heading">
|
395
|
-
<a href="#
|
249
|
+
<a href="#M000019" class="method-signature">
|
396
250
|
<span class="method-name">content_for</span><span class="method-args">( x ) {|| ...}</span>
|
397
251
|
</a>
|
398
252
|
</div>
|
399
253
|
|
400
254
|
<div class="method-description">
|
401
255
|
<p>
|
402
|
-
Calling <a href="Helpers.html#
|
256
|
+
Calling <a href="Helpers.html#M000019">content_for</a> stores a block of
|
403
257
|
markup in an identifier.
|
404
258
|
</p>
|
405
259
|
<pre>
|
@@ -435,26 +289,26 @@ markup in an identifier.
|
|
435
289
|
end
|
436
290
|
</pre>
|
437
291
|
<p><a class="source-toggle" href="#"
|
438
|
-
onclick="toggleCode('
|
439
|
-
<div class="method-source-code" id="
|
292
|
+
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
293
|
+
<div class="method-source-code" id="M000019-source">
|
440
294
|
<pre>
|
441
|
-
<span class="ruby-comment cmt"># File lib/capcode.rb, line
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
295
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 232</span>
|
296
|
+
232: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content_for</span>( <span class="ruby-identifier">x</span> )
|
297
|
+
233: <span class="ruby-comment cmt">#if @@__ARGS__.map{|_| _.to_s }.include?(x.to_s)</span>
|
298
|
+
234: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">Helpers</span>.<span class="ruby-identifier">args</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">_</span><span class="ruby-operator">|</span> <span class="ruby-identifier">_</span>.<span class="ruby-identifier">to_s</span> }.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">x</span>.<span class="ruby-identifier">to_s</span>)
|
299
|
+
235: <span class="ruby-keyword kw">yield</span>
|
300
|
+
236: <span class="ruby-keyword kw">end</span>
|
301
|
+
237: <span class="ruby-keyword kw">end</span>
|
448
302
|
</pre>
|
449
303
|
</div>
|
450
304
|
</div>
|
451
305
|
</div>
|
452
306
|
|
453
|
-
<div id="method-
|
454
|
-
<a name="
|
307
|
+
<div id="method-M000016" class="method-detail">
|
308
|
+
<a name="M000016"></a>
|
455
309
|
|
456
310
|
<div class="method-heading">
|
457
|
-
<a href="#
|
311
|
+
<a href="#M000016" class="method-signature">
|
458
312
|
<span class="method-name">json</span><span class="method-args">( d )</span>
|
459
313
|
</a>
|
460
314
|
</div>
|
@@ -474,36 +328,36 @@ Help you to return a JSON response
|
|
474
328
|
</pre>
|
475
329
|
<p>
|
476
330
|
<b>DEPRECATED</b>, please use <tt><a
|
477
|
-
href="Helpers.html#
|
478
|
-
href="Helpers.html#
|
331
|
+
href="Helpers.html#M000015">render</a>( :<a
|
332
|
+
href="Helpers.html#M000016">json</a> => o )</tt>
|
479
333
|
</p>
|
480
334
|
<p><a class="source-toggle" href="#"
|
481
|
-
onclick="toggleCode('
|
482
|
-
<div class="method-source-code" id="
|
335
|
+
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
336
|
+
<div class="method-source-code" id="M000016-source">
|
483
337
|
<pre>
|
484
|
-
<span class="ruby-comment cmt"># File lib/capcode.rb, line
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
338
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 128</span>
|
339
|
+
128: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">json</span>( <span class="ruby-identifier">d</span> ) <span class="ruby-comment cmt">## DELETE THIS IN 1.0.0</span>
|
340
|
+
129: <span class="ruby-identifier">warn</span>( <span class="ruby-value str">"json is deprecated and will be removed in version 1.0, please use `render( :json => ... )'"</span> )
|
341
|
+
130: <span class="ruby-ivar">@response</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-value str">'application/json'</span>
|
342
|
+
131: <span class="ruby-identifier">d</span>.<span class="ruby-identifier">to_json</span>
|
343
|
+
132: <span class="ruby-keyword kw">end</span>
|
490
344
|
</pre>
|
491
345
|
</div>
|
492
346
|
</div>
|
493
347
|
</div>
|
494
348
|
|
495
|
-
<div id="method-
|
496
|
-
<a name="
|
349
|
+
<div id="method-M000017" class="method-detail">
|
350
|
+
<a name="M000017"></a>
|
497
351
|
|
498
352
|
<div class="method-heading">
|
499
|
-
<a href="#
|
353
|
+
<a href="#M000017" class="method-signature">
|
500
354
|
<span class="method-name">redirect</span><span class="method-args">( klass, *a )</span>
|
501
355
|
</a>
|
502
356
|
</div>
|
503
357
|
|
504
358
|
<div class="method-description">
|
505
359
|
<p>
|
506
|
-
Send a <a href="Helpers.html#
|
360
|
+
Send a <a href="Helpers.html#M000017">redirect</a> response
|
507
361
|
</p>
|
508
362
|
<pre>
|
509
363
|
module Capcode
|
@@ -532,7 +386,7 @@ it can be a string path
|
|
532
386
|
</pre>
|
533
387
|
<p>
|
534
388
|
it can be an http status code (by default <tt><a
|
535
|
-
href="Helpers.html#
|
389
|
+
href="Helpers.html#M000017">redirect</a></tt> use the http status code 302)
|
536
390
|
</p>
|
537
391
|
<pre>
|
538
392
|
redirect( 304, MyController )
|
@@ -542,30 +396,30 @@ For more informations about HTTP status, see <a
|
|
542
396
|
href="http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection">en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection</a>
|
543
397
|
</p>
|
544
398
|
<p><a class="source-toggle" href="#"
|
545
|
-
onclick="toggleCode('
|
546
|
-
<div class="method-source-code" id="
|
399
|
+
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
400
|
+
<div class="method-source-code" id="M000017-source">
|
547
401
|
<pre>
|
548
|
-
<span class="ruby-comment cmt"># File lib/capcode.rb, line
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
402
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 161</span>
|
403
|
+
161: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">redirect</span>( <span class="ruby-identifier">klass</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">a</span> )
|
404
|
+
162: <span class="ruby-identifier">httpCode</span> = <span class="ruby-value">302</span>
|
405
|
+
163:
|
406
|
+
164: <span class="ruby-keyword kw">if</span>( <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Fixnum</span> )
|
407
|
+
165: <span class="ruby-identifier">httpCode</span> = <span class="ruby-identifier">klass</span>
|
408
|
+
166: <span class="ruby-identifier">klass</span> = <span class="ruby-identifier">a</span>.<span class="ruby-identifier">shift</span>
|
409
|
+
167: <span class="ruby-keyword kw">end</span>
|
410
|
+
168:
|
411
|
+
169: [<span class="ruby-identifier">httpCode</span>, {<span class="ruby-value str">'Location'</span> =<span class="ruby-operator">></span> <span class="ruby-constant">URL</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">a</span>)}, <span class="ruby-value str">''</span>]
|
412
|
+
170: <span class="ruby-keyword kw">end</span>
|
559
413
|
</pre>
|
560
414
|
</div>
|
561
415
|
</div>
|
562
416
|
</div>
|
563
417
|
|
564
|
-
<div id="method-
|
565
|
-
<a name="
|
418
|
+
<div id="method-M000015" class="method-detail">
|
419
|
+
<a name="M000015"></a>
|
566
420
|
|
567
421
|
<div class="method-heading">
|
568
|
-
<a href="#
|
422
|
+
<a href="#M000015" class="method-signature">
|
569
423
|
<span class="method-name">render</span><span class="method-args">( hash )</span>
|
570
424
|
</a>
|
571
425
|
</div>
|
@@ -575,7 +429,7 @@ href="http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection">en
|
|
575
429
|
Render a view
|
576
430
|
</p>
|
577
431
|
<p>
|
578
|
-
<a href="Helpers.html#
|
432
|
+
<a href="Helpers.html#M000015">render</a>‘s parameter can be a Hash
|
579
433
|
or a string. Passing a string is equivalent to do
|
580
434
|
</p>
|
581
435
|
<pre>
|
@@ -604,13 +458,13 @@ exist in sass_path
|
|
604
458
|
<li>:text => "my text"
|
605
459
|
|
606
460
|
</li>
|
607
|
-
<li>:<a href="Helpers.html#
|
461
|
+
<li>:<a href="Helpers.html#M000016">json</a> => MyObject : this suppose
|
608
462
|
that‘s MyObject respond to .to_json
|
609
463
|
|
610
464
|
</li>
|
611
|
-
<li>:<a href="Helpers.html#
|
465
|
+
<li>:<a href="Helpers.html#M000020">static</a> => "my_file.xxx" :
|
612
466
|
this suppose that‘s my_file.xxx exist in the <a
|
613
|
-
href="Helpers.html#
|
467
|
+
href="Helpers.html#M000020">static</a> directory
|
614
468
|
|
615
469
|
</li>
|
616
470
|
<li>:xml => :my_func : :my_func must be defined in <a
|
@@ -643,131 +497,86 @@ If you use the WebDav renderer, you can use the option
|
|
643
497
|
:resource_class (see http://github.com/georgi/rack_dav for more informations)
|
644
498
|
</pre>
|
645
499
|
<p><a class="source-toggle" href="#"
|
646
|
-
onclick="toggleCode('
|
647
|
-
<div class="method-source-code" id="
|
648
|
-
<pre>
|
649
|
-
<span class="ruby-comment cmt"># File lib/capcode.rb, line 79</span>
|
650
|
-
79: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span>( <span class="ruby-identifier">hash</span> )
|
651
|
-
80: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Hash</span>
|
652
|
-
81: <span class="ruby-identifier">render_type</span> = <span class="ruby-keyword kw">nil</span>
|
653
|
-
82:
|
654
|
-
83: <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
|
655
|
-
84: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-node">"render_#{key.to_s}"</span>)
|
656
|
-
85: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">render_type</span>.<span class="ruby-identifier">nil?</span>
|
657
|
-
86: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">RenderError</span>, <span class="ruby-node">"Can't use multiple renderer (`#{render_type}' and `#{key}') !"</span>, <span class="ruby-identifier">caller</span>
|
658
|
-
87: <span class="ruby-keyword kw">end</span>
|
659
|
-
88: <span class="ruby-identifier">render_type</span> = <span class="ruby-identifier">key</span>
|
660
|
-
89: <span class="ruby-keyword kw">end</span>
|
661
|
-
90: <span class="ruby-keyword kw">end</span>
|
662
|
-
91:
|
663
|
-
92: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">render_type</span>.<span class="ruby-identifier">nil?</span>
|
664
|
-
93: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">RenderError</span>, <span class="ruby-value str">"Renderer type not specified!"</span>, <span class="ruby-identifier">caller</span>
|
665
|
-
94: <span class="ruby-keyword kw">end</span>
|
666
|
-
95:
|
667
|
-
96: <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-node">"render_#{render_type.to_s}"</span>)
|
668
|
-
97: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">RenderError</span>, <span class="ruby-node">"#{render_type} renderer not present ! please require 'capcode/render/#{render_type}'"</span>, <span class="ruby-identifier">caller</span>
|
669
|
-
98: <span class="ruby-keyword kw">end</span>
|
670
|
-
99:
|
671
|
-
100: <span class="ruby-identifier">render_name</span> = <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">render_type</span>)
|
672
|
-
101: <span class="ruby-identifier">content_type</span> = <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:content_type</span>)
|
673
|
-
102: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">content_type</span>.<span class="ruby-identifier">nil?</span>
|
674
|
-
103: <span class="ruby-ivar">@response</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-identifier">content_type</span>
|
675
|
-
104: <span class="ruby-keyword kw">end</span>
|
676
|
-
105:
|
677
|
-
106: <span class="ruby-keyword kw">begin</span>
|
678
|
-
107: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>( <span class="ruby-node">"render_#{render_type.to_s}"</span>, <span class="ruby-identifier">render_name</span>, <span class="ruby-identifier">hash</span> )
|
679
|
-
108: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
680
|
-
109: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">RenderError</span>, <span class="ruby-node">"Error rendering `#{render_type.to_s}' : #{e.message}"</span>, <span class="ruby-identifier">caller</span>
|
681
|
-
110: <span class="ruby-keyword kw">end</span>
|
682
|
-
111: <span class="ruby-keyword kw">else</span>
|
683
|
-
112: <span class="ruby-identifier">render</span>( <span class="ruby-identifier">:text</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">hash</span> )
|
684
|
-
113: <span class="ruby-keyword kw">end</span>
|
685
|
-
114: <span class="ruby-keyword kw">end</span>
|
686
|
-
</pre>
|
687
|
-
</div>
|
688
|
-
</div>
|
689
|
-
</div>
|
690
|
-
|
691
|
-
<div id="method-M000025" class="method-detail">
|
692
|
-
<a name="M000025"></a>
|
693
|
-
|
694
|
-
<div class="method-heading">
|
695
|
-
<a href="#M000025" class="method-signature">
|
696
|
-
<span class="method-name">render_webdav</span><span class="method-args">( f, opts )</span>
|
697
|
-
</a>
|
698
|
-
</div>
|
699
|
-
|
700
|
-
<div class="method-description">
|
701
|
-
<p><a class="source-toggle" href="#"
|
702
|
-
onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
|
703
|
-
<div class="method-source-code" id="M000025-source">
|
500
|
+
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
501
|
+
<div class="method-source-code" id="M000015-source">
|
704
502
|
<pre>
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
503
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 80</span>
|
504
|
+
80: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span>( <span class="ruby-identifier">hash</span> )
|
505
|
+
81: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Hash</span>
|
506
|
+
82: <span class="ruby-identifier">render_type</span> = <span class="ruby-keyword kw">nil</span>
|
507
|
+
83:
|
508
|
+
84: <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
|
509
|
+
85: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-node">"render_#{key.to_s}"</span>)
|
510
|
+
86: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">render_type</span>.<span class="ruby-identifier">nil?</span>
|
511
|
+
87: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">RenderError</span>, <span class="ruby-node">"Can't use multiple renderer (`#{render_type}' and `#{key}') !"</span>, <span class="ruby-identifier">caller</span>
|
512
|
+
88: <span class="ruby-keyword kw">end</span>
|
513
|
+
89: <span class="ruby-identifier">render_type</span> = <span class="ruby-identifier">key</span>
|
514
|
+
90: <span class="ruby-keyword kw">end</span>
|
515
|
+
91: <span class="ruby-keyword kw">end</span>
|
516
|
+
92:
|
517
|
+
93: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">render_type</span>.<span class="ruby-identifier">nil?</span>
|
518
|
+
94: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">RenderError</span>, <span class="ruby-value str">"Renderer type not specified!"</span>, <span class="ruby-identifier">caller</span>
|
519
|
+
95: <span class="ruby-keyword kw">end</span>
|
520
|
+
96:
|
521
|
+
97: <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-node">"render_#{render_type.to_s}"</span>)
|
522
|
+
98: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">RenderError</span>, <span class="ruby-node">"#{render_type} renderer not present ! please require 'capcode/render/#{render_type}'"</span>, <span class="ruby-identifier">caller</span>
|
523
|
+
99: <span class="ruby-keyword kw">end</span>
|
524
|
+
100:
|
525
|
+
101: <span class="ruby-identifier">render_name</span> = <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">render_type</span>)
|
526
|
+
102: <span class="ruby-identifier">content_type</span> = <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:content_type</span>)
|
527
|
+
103: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">content_type</span>.<span class="ruby-identifier">nil?</span>
|
528
|
+
104: <span class="ruby-ivar">@response</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-identifier">content_type</span>
|
529
|
+
105: <span class="ruby-keyword kw">end</span>
|
530
|
+
106:
|
531
|
+
107: <span class="ruby-keyword kw">begin</span>
|
532
|
+
108: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>( <span class="ruby-node">"render_#{render_type.to_s}"</span>, <span class="ruby-identifier">render_name</span>, <span class="ruby-identifier">hash</span> )
|
533
|
+
109: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
534
|
+
110: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Capcode</span><span class="ruby-operator">::</span><span class="ruby-constant">RenderError</span>, <span class="ruby-node">"Error rendering `#{render_type.to_s}' : #{e.message}"</span>, <span class="ruby-identifier">caller</span>
|
535
|
+
111: <span class="ruby-keyword kw">end</span>
|
536
|
+
112: <span class="ruby-keyword kw">else</span>
|
537
|
+
113: <span class="ruby-identifier">render</span>( <span class="ruby-identifier">:text</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">hash</span> )
|
538
|
+
114: <span class="ruby-keyword kw">end</span>
|
539
|
+
115: <span class="ruby-keyword kw">end</span>
|
731
540
|
</pre>
|
732
541
|
</div>
|
733
542
|
</div>
|
734
543
|
</div>
|
735
544
|
|
736
|
-
<div id="method-
|
737
|
-
<a name="
|
545
|
+
<div id="method-M000020" class="method-detail">
|
546
|
+
<a name="M000020"></a>
|
738
547
|
|
739
548
|
<div class="method-heading">
|
740
|
-
<a href="#
|
549
|
+
<a href="#M000020" class="method-signature">
|
741
550
|
<span class="method-name">static</span><span class="method-args">()</span>
|
742
551
|
</a>
|
743
552
|
</div>
|
744
553
|
|
745
554
|
<div class="method-description">
|
746
555
|
<p>
|
747
|
-
Return information about the <a href="Helpers.html#
|
556
|
+
Return information about the <a href="Helpers.html#M000020">static</a>
|
748
557
|
directory
|
749
558
|
</p>
|
750
559
|
<ul>
|
751
|
-
<li><tt><a href="Helpers.html#
|
752
|
-
href="Helpers.html#
|
560
|
+
<li><tt><a href="Helpers.html#M000020">static</a>[:uri]</tt> give the <a
|
561
|
+
href="Helpers.html#M000020">static</a> URI
|
753
562
|
|
754
563
|
</li>
|
755
|
-
<li><tt><a href="Helpers.html#
|
756
|
-
the <a href="Helpers.html#
|
564
|
+
<li><tt><a href="Helpers.html#M000020">static</a>[:path]</tt> give the path to
|
565
|
+
the <a href="Helpers.html#M000020">static</a> directory on the server
|
757
566
|
|
758
567
|
</li>
|
759
568
|
</ul>
|
760
569
|
<p><a class="source-toggle" href="#"
|
761
|
-
onclick="toggleCode('
|
762
|
-
<div class="method-source-code" id="
|
570
|
+
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
571
|
+
<div class="method-source-code" id="M000020-source">
|
763
572
|
<pre>
|
764
|
-
<span class="ruby-comment cmt"># File lib/capcode.rb, line
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
573
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 243</span>
|
574
|
+
243: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">static</span>
|
575
|
+
244: {
|
576
|
+
245: <span class="ruby-identifier">:uri</span> =<span class="ruby-operator">></span> <span class="ruby-constant">Capcode</span>.<span class="ruby-identifier">static</span>,
|
577
|
+
246: <span class="ruby-identifier">:path</span> =<span class="ruby-operator">></span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>( <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"."</span>, <span class="ruby-constant">Capcode</span>.<span class="ruby-identifier">static</span> ) )
|
578
|
+
247: }
|
579
|
+
248: <span class="ruby-keyword kw">end</span>
|
771
580
|
</pre>
|
772
581
|
</div>
|
773
582
|
</div>
|