Capcode 0.8.4 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +58 -0
- data/doc/rdoc/classes/Capcode.html +938 -0
- data/doc/rdoc/classes/Capcode/Base.html +136 -0
- data/doc/rdoc/classes/Capcode/HTTPError.html +134 -0
- data/doc/rdoc/classes/Capcode/Helpers.html +608 -0
- data/doc/rdoc/classes/Capcode/Helpers/Authorization.html +188 -0
- data/doc/rdoc/classes/Capcode/Mab.html +118 -0
- data/doc/rdoc/classes/Capcode/Resource.html +111 -0
- data/doc/rdoc/classes/Capcode/Views.html +112 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/AUTHORS.html +107 -0
- data/doc/rdoc/files/COPYING.html +531 -0
- data/doc/rdoc/files/README_rdoc.html +601 -0
- data/doc/rdoc/files/lib/capcode/base/db_rb.html +101 -0
- data/doc/rdoc/files/lib/capcode/helpers/auth_rb.html +132 -0
- data/doc/rdoc/files/lib/capcode/render/erb_rb.html +108 -0
- data/doc/rdoc/files/lib/capcode/render/haml_rb.html +108 -0
- data/doc/rdoc/files/lib/capcode/render/json_rb.html +108 -0
- data/doc/rdoc/files/lib/capcode/render/markaby_rb.html +108 -0
- data/doc/rdoc/files/lib/capcode/render/sass_rb.html +108 -0
- data/doc/rdoc/files/lib/capcode/render/static_rb.html +101 -0
- data/doc/rdoc/files/lib/capcode/render/text_rb.html +101 -0
- data/doc/rdoc/files/lib/capcode/render/webdav_rb.html +124 -0
- data/doc/rdoc/files/lib/capcode/render/xml_rb.html +101 -0
- data/doc/rdoc/files/lib/capcode_rb.html +119 -0
- data/doc/rdoc/fr_class_index.html +34 -0
- data/doc/rdoc/fr_file_index.html +41 -0
- data/doc/rdoc/fr_method_index.html +44 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/examples/auth-basic.rb +46 -0
- data/examples/auth-digest.rb +47 -0
- data/examples/auth-webdav.rb +29 -0
- data/examples/blog-couchdb-run.rb +10 -0
- data/examples/blog-couchdb.rb +8 -8
- data/examples/blog-couchdb.ru +12 -0
- data/examples/render-static.rb +1 -1
- data/examples/render-static.ru +21 -0
- data/examples/render-webdav.rb +26 -0
- data/examples/rest-run.rb +3 -0
- data/examples/rest.rb +1 -1
- data/examples/rest.ru +3 -0
- data/lib/capcode.rb +196 -100
- data/lib/capcode/helpers/auth.rb +130 -0
- data/lib/capcode/render/webdav.rb +45 -0
- data/lib/capcode/version.rb +1 -1
- metadata +45 -3
@@ -0,0 +1,136 @@
|
|
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::Base</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::Base</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/capcode/base/db_rb.html">
|
59
|
+
lib/capcode/base/db.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
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
This class allow you to define models
|
84
|
+
</p>
|
85
|
+
<pre>
|
86
|
+
class Story < Capcode::Base
|
87
|
+
include Capcode::Resource
|
88
|
+
|
89
|
+
property :id, Integer, :serial => true
|
90
|
+
property :title, String
|
91
|
+
property :body, String
|
92
|
+
property :date, String
|
93
|
+
end
|
94
|
+
</pre>
|
95
|
+
<p>
|
96
|
+
If you want to use DataMapper, you need to require
|
97
|
+
"capcode/base/dm", if you want to use CouchDB (via couch_foo),
|
98
|
+
you need to require "capcode/base/couchdb".
|
99
|
+
</p>
|
100
|
+
<p>
|
101
|
+
Please, refer to the DataMapper or couch_foo documentation for more
|
102
|
+
information.
|
103
|
+
</p>
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
|
108
|
+
</div>
|
109
|
+
|
110
|
+
|
111
|
+
</div>
|
112
|
+
|
113
|
+
|
114
|
+
<!-- if includes -->
|
115
|
+
|
116
|
+
<div id="section">
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
<!-- if method_list -->
|
126
|
+
|
127
|
+
|
128
|
+
</div>
|
129
|
+
|
130
|
+
|
131
|
+
<div id="validator-badges">
|
132
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
133
|
+
</div>
|
134
|
+
|
135
|
+
</body>
|
136
|
+
</html>
|
@@ -0,0 +1,134 @@
|
|
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::HTTPError</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::HTTPError</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/capcode_rb.html">
|
59
|
+
lib/capcode.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
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
<a href="HTTPError.html">HTTPError</a> help you to create your own 404, 500
|
84
|
+
and/or 501 response
|
85
|
+
</p>
|
86
|
+
<p>
|
87
|
+
To create a custom 404 reponse, create a fonction HTTPError.r404 in your
|
88
|
+
application :
|
89
|
+
</p>
|
90
|
+
<pre>
|
91
|
+
module Capcode
|
92
|
+
class HTTPError
|
93
|
+
def r404(f)
|
94
|
+
"#{f} not found :("
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
</pre>
|
99
|
+
<p>
|
100
|
+
Do the same (r500, r501, r403) to customize 500, 501, 403 errors
|
101
|
+
</p>
|
102
|
+
|
103
|
+
</div>
|
104
|
+
|
105
|
+
|
106
|
+
</div>
|
107
|
+
|
108
|
+
|
109
|
+
</div>
|
110
|
+
|
111
|
+
|
112
|
+
<!-- if includes -->
|
113
|
+
|
114
|
+
<div id="section">
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
<!-- if method_list -->
|
124
|
+
|
125
|
+
|
126
|
+
</div>
|
127
|
+
|
128
|
+
|
129
|
+
<div id="validator-badges">
|
130
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
131
|
+
</div>
|
132
|
+
|
133
|
+
</body>
|
134
|
+
</html>
|
@@ -0,0 +1,608 @@
|
|
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: Capcode::Helpers</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">Capcode::Helpers</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/capcode_rb.html">
|
59
|
+
lib/capcode.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
<a href="../../files/lib/capcode/render/erb_rb.html">
|
63
|
+
lib/capcode/render/erb.rb
|
64
|
+
</a>
|
65
|
+
<br />
|
66
|
+
<a href="../../files/lib/capcode/render/haml_rb.html">
|
67
|
+
lib/capcode/render/haml.rb
|
68
|
+
</a>
|
69
|
+
<br />
|
70
|
+
<a href="../../files/lib/capcode/render/json_rb.html">
|
71
|
+
lib/capcode/render/json.rb
|
72
|
+
</a>
|
73
|
+
<br />
|
74
|
+
<a href="../../files/lib/capcode/render/markaby_rb.html">
|
75
|
+
lib/capcode/render/markaby.rb
|
76
|
+
</a>
|
77
|
+
<br />
|
78
|
+
<a href="../../files/lib/capcode/render/sass_rb.html">
|
79
|
+
lib/capcode/render/sass.rb
|
80
|
+
</a>
|
81
|
+
<br />
|
82
|
+
<a href="../../files/lib/capcode/render/static_rb.html">
|
83
|
+
lib/capcode/render/static.rb
|
84
|
+
</a>
|
85
|
+
<br />
|
86
|
+
<a href="../../files/lib/capcode/render/text_rb.html">
|
87
|
+
lib/capcode/render/text.rb
|
88
|
+
</a>
|
89
|
+
<br />
|
90
|
+
<a href="../../files/lib/capcode/render/webdav_rb.html">
|
91
|
+
lib/capcode/render/webdav.rb
|
92
|
+
</a>
|
93
|
+
<br />
|
94
|
+
<a href="../../files/lib/capcode/render/xml_rb.html">
|
95
|
+
lib/capcode/render/xml.rb
|
96
|
+
</a>
|
97
|
+
<br />
|
98
|
+
<a href="../../files/lib/capcode/helpers/auth_rb.html">
|
99
|
+
lib/capcode/helpers/auth.rb
|
100
|
+
</a>
|
101
|
+
<br />
|
102
|
+
</td>
|
103
|
+
</tr>
|
104
|
+
|
105
|
+
</table>
|
106
|
+
</div>
|
107
|
+
<!-- banner header -->
|
108
|
+
|
109
|
+
<div id="bodyContent">
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
<div id="contextContent">
|
114
|
+
|
115
|
+
<div id="description">
|
116
|
+
<p>
|
117
|
+
<a href="Helpers.html">Helpers</a> contains methods available in your
|
118
|
+
controllers
|
119
|
+
</p>
|
120
|
+
|
121
|
+
</div>
|
122
|
+
|
123
|
+
|
124
|
+
</div>
|
125
|
+
|
126
|
+
<div id="method-list">
|
127
|
+
<h3 class="section-bar">Methods</h3>
|
128
|
+
|
129
|
+
<div class="name-list">
|
130
|
+
<a href="#M000014">URL</a>
|
131
|
+
<a href="#M000015">content_for</a>
|
132
|
+
<a href="#M000012">json</a>
|
133
|
+
<a href="#M000013">redirect</a>
|
134
|
+
<a href="#M000011">render</a>
|
135
|
+
<a href="#M000017">render_webdav</a>
|
136
|
+
<a href="#M000016">static</a>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
</div>
|
141
|
+
|
142
|
+
|
143
|
+
<!-- if includes -->
|
144
|
+
<div id="includes">
|
145
|
+
<h3 class="section-bar">Included Modules</h3>
|
146
|
+
|
147
|
+
<div id="includes-list">
|
148
|
+
<span class="include-name"><a href="Helpers/Authorization.html">Authorization</a></span>
|
149
|
+
</div>
|
150
|
+
</div>
|
151
|
+
|
152
|
+
<div id="section">
|
153
|
+
|
154
|
+
<div id="class-list">
|
155
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
156
|
+
|
157
|
+
Module <a href="Helpers/Authorization.html" class="link">Capcode::Helpers::Authorization</a><br />
|
158
|
+
|
159
|
+
</div>
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<!-- if method_list -->
|
168
|
+
<div id="methods">
|
169
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
170
|
+
|
171
|
+
<div id="method-M000014" class="method-detail">
|
172
|
+
<a name="M000014"></a>
|
173
|
+
|
174
|
+
<div class="method-heading">
|
175
|
+
<a href="#M000014" class="method-signature">
|
176
|
+
<span class="method-name">URL</span><span class="method-args">( klass, *a )</span>
|
177
|
+
</a>
|
178
|
+
</div>
|
179
|
+
|
180
|
+
<div class="method-description">
|
181
|
+
<p>
|
182
|
+
Builds an <a href="Helpers.html#M000014">URL</a> route to a controller or a
|
183
|
+
path
|
184
|
+
</p>
|
185
|
+
<p>
|
186
|
+
if you declare the controller Hello :
|
187
|
+
</p>
|
188
|
+
<pre>
|
189
|
+
module Capcode
|
190
|
+
class Hello < Route '/hello/(.*)'
|
191
|
+
...
|
192
|
+
end
|
193
|
+
end
|
194
|
+
</pre>
|
195
|
+
<p>
|
196
|
+
then
|
197
|
+
</p>
|
198
|
+
<pre>
|
199
|
+
URL( Capcode::Hello, "you" ) # => /hello/you
|
200
|
+
</pre>
|
201
|
+
<p><a class="source-toggle" href="#"
|
202
|
+
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
203
|
+
<div class="method-source-code" id="M000014-source">
|
204
|
+
<pre>
|
205
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 164</span>
|
206
|
+
164: <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> )
|
207
|
+
165: <span class="ruby-identifier">path</span> = <span class="ruby-keyword kw">nil</span>
|
208
|
+
166: <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> }
|
209
|
+
167:
|
210
|
+
168: <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>
|
211
|
+
169: <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>
|
212
|
+
170: <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>
|
213
|
+
171: <span class="ruby-keyword kw">end</span>
|
214
|
+
172: <span class="ruby-keyword kw">else</span>
|
215
|
+
173: <span class="ruby-identifier">path</span> = <span class="ruby-identifier">klass</span>
|
216
|
+
174: <span class="ruby-keyword kw">end</span>
|
217
|
+
175:
|
218
|
+
176: (<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>))
|
219
|
+
177: <span class="ruby-keyword kw">end</span>
|
220
|
+
</pre>
|
221
|
+
</div>
|
222
|
+
</div>
|
223
|
+
</div>
|
224
|
+
|
225
|
+
<div id="method-M000015" class="method-detail">
|
226
|
+
<a name="M000015"></a>
|
227
|
+
|
228
|
+
<div class="method-heading">
|
229
|
+
<a href="#M000015" class="method-signature">
|
230
|
+
<span class="method-name">content_for</span><span class="method-args">( x ) {|| ...}</span>
|
231
|
+
</a>
|
232
|
+
</div>
|
233
|
+
|
234
|
+
<div class="method-description">
|
235
|
+
<p>
|
236
|
+
Calling <a href="Helpers.html#M000015">content_for</a> stores a block of
|
237
|
+
markup in an identifier.
|
238
|
+
</p>
|
239
|
+
<pre>
|
240
|
+
module Capcode
|
241
|
+
class ContentFor < Route '/'
|
242
|
+
def get
|
243
|
+
render( :markaby => :page, :layout => :layout )
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
module Capcode::Views
|
249
|
+
def layout
|
250
|
+
html do
|
251
|
+
head do
|
252
|
+
yield :header
|
253
|
+
end
|
254
|
+
body do
|
255
|
+
yield :content
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
def page
|
261
|
+
content_for :header do
|
262
|
+
title "This is the title!"
|
263
|
+
end
|
264
|
+
|
265
|
+
content_for :content do
|
266
|
+
p "this is the content!"
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
270
|
+
</pre>
|
271
|
+
<p><a class="source-toggle" href="#"
|
272
|
+
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
273
|
+
<div class="method-source-code" id="M000015-source">
|
274
|
+
<pre>
|
275
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 211</span>
|
276
|
+
211: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content_for</span>( <span class="ruby-identifier">x</span> )
|
277
|
+
212: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@@__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>)
|
278
|
+
213: <span class="ruby-keyword kw">yield</span>
|
279
|
+
214: <span class="ruby-keyword kw">end</span>
|
280
|
+
215: <span class="ruby-keyword kw">end</span>
|
281
|
+
</pre>
|
282
|
+
</div>
|
283
|
+
</div>
|
284
|
+
</div>
|
285
|
+
|
286
|
+
<div id="method-M000012" class="method-detail">
|
287
|
+
<a name="M000012"></a>
|
288
|
+
|
289
|
+
<div class="method-heading">
|
290
|
+
<a href="#M000012" class="method-signature">
|
291
|
+
<span class="method-name">json</span><span class="method-args">( d )</span>
|
292
|
+
</a>
|
293
|
+
</div>
|
294
|
+
|
295
|
+
<div class="method-description">
|
296
|
+
<p>
|
297
|
+
Help you to return a JSON response
|
298
|
+
</p>
|
299
|
+
<pre>
|
300
|
+
module Capcode
|
301
|
+
class JsonResponse < Route '/json/([^\/]*)/(.*)'
|
302
|
+
def get( arg1, arg2 )
|
303
|
+
json( { :1 => arg1, :2 => arg2 })
|
304
|
+
end
|
305
|
+
end
|
306
|
+
end
|
307
|
+
</pre>
|
308
|
+
<p>
|
309
|
+
<b>DEPRECATED</b>, please use <tt><a
|
310
|
+
href="Helpers.html#M000011">render</a>( :<a
|
311
|
+
href="Helpers.html#M000012">json</a> => o )</tt>
|
312
|
+
</p>
|
313
|
+
<p><a class="source-toggle" href="#"
|
314
|
+
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
315
|
+
<div class="method-source-code" id="M000012-source">
|
316
|
+
<pre>
|
317
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 107</span>
|
318
|
+
107: <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>
|
319
|
+
108: <span class="ruby-identifier">warn</span>( <span class="ruby-value str">"json is deprecated, please use `render( :json => ... )'"</span> )
|
320
|
+
109: <span class="ruby-ivar">@response</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-value str">'application/json'</span>
|
321
|
+
110: <span class="ruby-identifier">d</span>.<span class="ruby-identifier">to_json</span>
|
322
|
+
111: <span class="ruby-keyword kw">end</span>
|
323
|
+
</pre>
|
324
|
+
</div>
|
325
|
+
</div>
|
326
|
+
</div>
|
327
|
+
|
328
|
+
<div id="method-M000013" class="method-detail">
|
329
|
+
<a name="M000013"></a>
|
330
|
+
|
331
|
+
<div class="method-heading">
|
332
|
+
<a href="#M000013" class="method-signature">
|
333
|
+
<span class="method-name">redirect</span><span class="method-args">( klass, *a )</span>
|
334
|
+
</a>
|
335
|
+
</div>
|
336
|
+
|
337
|
+
<div class="method-description">
|
338
|
+
<p>
|
339
|
+
Send a <a href="Helpers.html#M000013">redirect</a> response
|
340
|
+
</p>
|
341
|
+
<pre>
|
342
|
+
module Capcode
|
343
|
+
class Hello < Route '/hello/(.*)'
|
344
|
+
def get( you )
|
345
|
+
if you.nil?
|
346
|
+
redirect( WhoAreYou )
|
347
|
+
else
|
348
|
+
...
|
349
|
+
end
|
350
|
+
end
|
351
|
+
end
|
352
|
+
end
|
353
|
+
</pre>
|
354
|
+
<p>
|
355
|
+
The first parameter can be a controller class name
|
356
|
+
</p>
|
357
|
+
<pre>
|
358
|
+
redirect( MyController )
|
359
|
+
</pre>
|
360
|
+
<p>
|
361
|
+
it can be a string path
|
362
|
+
</p>
|
363
|
+
<pre>
|
364
|
+
redirect( "/path/to/my/resource" )
|
365
|
+
</pre>
|
366
|
+
<p>
|
367
|
+
it can be an http status code (by default <tt><a
|
368
|
+
href="Helpers.html#M000013">redirect</a></tt> use the http status code 302)
|
369
|
+
</p>
|
370
|
+
<pre>
|
371
|
+
redirect( 304, MyController )
|
372
|
+
</pre>
|
373
|
+
<p>
|
374
|
+
For more informations about HTTP status, see <a
|
375
|
+
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>
|
376
|
+
</p>
|
377
|
+
<p><a class="source-toggle" href="#"
|
378
|
+
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
379
|
+
<div class="method-source-code" id="M000013-source">
|
380
|
+
<pre>
|
381
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 140</span>
|
382
|
+
140: <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> )
|
383
|
+
141: <span class="ruby-identifier">httpCode</span> = <span class="ruby-value">302</span>
|
384
|
+
142:
|
385
|
+
143: <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> )
|
386
|
+
144: <span class="ruby-identifier">httpCode</span> = <span class="ruby-identifier">klass</span>
|
387
|
+
145: <span class="ruby-identifier">klass</span> = <span class="ruby-identifier">a</span>.<span class="ruby-identifier">shift</span>
|
388
|
+
146: <span class="ruby-keyword kw">end</span>
|
389
|
+
147:
|
390
|
+
148: [<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>]
|
391
|
+
149: <span class="ruby-keyword kw">end</span>
|
392
|
+
</pre>
|
393
|
+
</div>
|
394
|
+
</div>
|
395
|
+
</div>
|
396
|
+
|
397
|
+
<div id="method-M000011" class="method-detail">
|
398
|
+
<a name="M000011"></a>
|
399
|
+
|
400
|
+
<div class="method-heading">
|
401
|
+
<a href="#M000011" class="method-signature">
|
402
|
+
<span class="method-name">render</span><span class="method-args">( hash )</span>
|
403
|
+
</a>
|
404
|
+
</div>
|
405
|
+
|
406
|
+
<div class="method-description">
|
407
|
+
<p>
|
408
|
+
Render a view
|
409
|
+
</p>
|
410
|
+
<p>
|
411
|
+
<a href="Helpers.html#M000011">render</a>‘s parameter can be a Hash
|
412
|
+
or a string. Passing a string is equivalent to do
|
413
|
+
</p>
|
414
|
+
<pre>
|
415
|
+
render( :text => string )
|
416
|
+
</pre>
|
417
|
+
<p>
|
418
|
+
If you want to use a specific renderer, use one of this options :
|
419
|
+
</p>
|
420
|
+
<ul>
|
421
|
+
<li>:markaby => :my_func : :my_func must be defined in <a
|
422
|
+
href="Views.html">Capcode::Views</a>
|
423
|
+
|
424
|
+
</li>
|
425
|
+
<li>:erb => :my_erb_file : this suppose that‘s my_erb_file.rhtml exist
|
426
|
+
in erb_path
|
427
|
+
|
428
|
+
</li>
|
429
|
+
<li>:haml => :my_haml_file : this suppose that‘s my_haml_file.haml
|
430
|
+
exist in haml_path
|
431
|
+
|
432
|
+
</li>
|
433
|
+
<li>:sass => :my_sass_file : this suppose that‘s my_sass_file.sass
|
434
|
+
exist in sass_path
|
435
|
+
|
436
|
+
</li>
|
437
|
+
<li>:text => "my text"
|
438
|
+
|
439
|
+
</li>
|
440
|
+
<li>:<a href="Helpers.html#M000012">json</a> => MyObject : this suppose
|
441
|
+
that‘s MyObject respond to .to_json
|
442
|
+
|
443
|
+
</li>
|
444
|
+
<li>:<a href="Helpers.html#M000016">static</a> => "my_file.xxx" :
|
445
|
+
this suppose that‘s my_file.xxx exist in the <a
|
446
|
+
href="Helpers.html#M000016">static</a> directory
|
447
|
+
|
448
|
+
</li>
|
449
|
+
<li>:xml => :my_func : :my_func must be defined in <a
|
450
|
+
href="Views.html">Capcode::Views</a>
|
451
|
+
|
452
|
+
</li>
|
453
|
+
<li>:webdav => /path/to/root
|
454
|
+
|
455
|
+
</li>
|
456
|
+
</ul>
|
457
|
+
<p>
|
458
|
+
If you want to use a specific layout, you can specify it with option
|
459
|
+
</p>
|
460
|
+
<pre>
|
461
|
+
:layout
|
462
|
+
</pre>
|
463
|
+
<p>
|
464
|
+
If you use the WebDav renderer, you can use the option
|
465
|
+
</p>
|
466
|
+
<pre>
|
467
|
+
:resource_class (see http://github.com/georgi/rack_dav for more informations)
|
468
|
+
</pre>
|
469
|
+
<p><a class="source-toggle" href="#"
|
470
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
471
|
+
<div class="method-source-code" id="M000011-source">
|
472
|
+
<pre>
|
473
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 63</span>
|
474
|
+
63: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span>( <span class="ruby-identifier">hash</span> )
|
475
|
+
64: <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>
|
476
|
+
65: <span class="ruby-identifier">render_type</span> = <span class="ruby-keyword kw">nil</span>
|
477
|
+
66:
|
478
|
+
67: <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>
|
479
|
+
68: <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>)
|
480
|
+
69: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">render_type</span>.<span class="ruby-identifier">nil?</span>
|
481
|
+
70: <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>
|
482
|
+
71: <span class="ruby-keyword kw">end</span>
|
483
|
+
72: <span class="ruby-identifier">render_type</span> = <span class="ruby-identifier">key</span>
|
484
|
+
73: <span class="ruby-keyword kw">end</span>
|
485
|
+
74: <span class="ruby-keyword kw">end</span>
|
486
|
+
75:
|
487
|
+
76: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">render_type</span>.<span class="ruby-identifier">nil?</span>
|
488
|
+
77: <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>
|
489
|
+
78: <span class="ruby-keyword kw">end</span>
|
490
|
+
79:
|
491
|
+
80: <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>)
|
492
|
+
81: <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>
|
493
|
+
82: <span class="ruby-keyword kw">end</span>
|
494
|
+
83:
|
495
|
+
84: <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>)
|
496
|
+
85:
|
497
|
+
86: <span class="ruby-keyword kw">begin</span>
|
498
|
+
87: <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> )
|
499
|
+
88: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
500
|
+
89: <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>
|
501
|
+
90: <span class="ruby-keyword kw">end</span>
|
502
|
+
91: <span class="ruby-keyword kw">else</span>
|
503
|
+
92: <span class="ruby-identifier">render</span>( <span class="ruby-identifier">:text</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">hash</span> )
|
504
|
+
93: <span class="ruby-keyword kw">end</span>
|
505
|
+
94: <span class="ruby-keyword kw">end</span>
|
506
|
+
</pre>
|
507
|
+
</div>
|
508
|
+
</div>
|
509
|
+
</div>
|
510
|
+
|
511
|
+
<div id="method-M000017" class="method-detail">
|
512
|
+
<a name="M000017"></a>
|
513
|
+
|
514
|
+
<div class="method-heading">
|
515
|
+
<a href="#M000017" class="method-signature">
|
516
|
+
<span class="method-name">render_webdav</span><span class="method-args">( f, opts )</span>
|
517
|
+
</a>
|
518
|
+
</div>
|
519
|
+
|
520
|
+
<div class="method-description">
|
521
|
+
<p><a class="source-toggle" href="#"
|
522
|
+
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
523
|
+
<div class="method-source-code" id="M000017-source">
|
524
|
+
<pre>
|
525
|
+
<span class="ruby-comment cmt"># File lib/capcode/render/webdav.rb, line 19</span>
|
526
|
+
19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render_webdav</span>( <span class="ruby-identifier">f</span>, <span class="ruby-identifier">opts</span> )
|
527
|
+
20: <span class="ruby-identifier">options</span> = {
|
528
|
+
21: <span class="ruby-identifier">:resource_class</span> =<span class="ruby-operator">></span> <span class="ruby-constant">RackDAV</span><span class="ruby-operator">::</span><span class="ruby-constant">FileResource</span>,
|
529
|
+
22: <span class="ruby-identifier">:root</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">f</span>
|
530
|
+
23: }.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">opts</span>)
|
531
|
+
24:
|
532
|
+
25: <span class="ruby-identifier">request</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">env</span>)
|
533
|
+
26: <span class="ruby-identifier">response</span> = <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Response</span>.<span class="ruby-identifier">new</span>
|
534
|
+
27:
|
535
|
+
28: <span class="ruby-keyword kw">begin</span>
|
536
|
+
29: <span class="ruby-identifier">controller</span> = <span class="ruby-constant">RackDAV</span><span class="ruby-operator">::</span><span class="ruby-constant">Controller</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>, <span class="ruby-identifier">options</span>.<span class="ruby-identifier">dup</span>)
|
537
|
+
30: <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">request</span>.<span class="ruby-identifier">request_method</span>.<span class="ruby-identifier">downcase</span>)
|
538
|
+
31: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">RackDAV</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTPStatus</span><span class="ruby-operator">::</span><span class="ruby-constant">Status</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">status</span>
|
539
|
+
32: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span> = <span class="ruby-identifier">status</span>.<span class="ruby-identifier">code</span>
|
540
|
+
33: <span class="ruby-keyword kw">end</span>
|
541
|
+
34:
|
542
|
+
35: <span class="ruby-comment cmt"># Strings in Ruby 1.9 are no longer enumerable. Rack still expects the response.body to be</span>
|
543
|
+
36: <span class="ruby-comment cmt"># enumerable, however.</span>
|
544
|
+
37: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span> = [<span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:each</span>
|
545
|
+
38:
|
546
|
+
39: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span> = <span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span> <span class="ruby-value">? </span><span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">:</span> <span class="ruby-value">200</span>
|
547
|
+
40: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">finish</span>
|
548
|
+
41:
|
549
|
+
42: [<span class="ruby-identifier">response</span>.<span class="ruby-identifier">status</span>, <span class="ruby-identifier">response</span>.<span class="ruby-identifier">header</span>, <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>]
|
550
|
+
43: <span class="ruby-keyword kw">end</span>
|
551
|
+
</pre>
|
552
|
+
</div>
|
553
|
+
</div>
|
554
|
+
</div>
|
555
|
+
|
556
|
+
<div id="method-M000016" class="method-detail">
|
557
|
+
<a name="M000016"></a>
|
558
|
+
|
559
|
+
<div class="method-heading">
|
560
|
+
<a href="#M000016" class="method-signature">
|
561
|
+
<span class="method-name">static</span><span class="method-args">()</span>
|
562
|
+
</a>
|
563
|
+
</div>
|
564
|
+
|
565
|
+
<div class="method-description">
|
566
|
+
<p>
|
567
|
+
Return information about the <a href="Helpers.html#M000016">static</a>
|
568
|
+
directory
|
569
|
+
</p>
|
570
|
+
<ul>
|
571
|
+
<li><tt><a href="Helpers.html#M000016">static</a>[:uri]</tt> give the <a
|
572
|
+
href="Helpers.html#M000016">static</a> URI
|
573
|
+
|
574
|
+
</li>
|
575
|
+
<li><tt><a href="Helpers.html#M000016">static</a>[:path]</tt> give the path to
|
576
|
+
the <a href="Helpers.html#M000016">static</a> directory on the server
|
577
|
+
|
578
|
+
</li>
|
579
|
+
</ul>
|
580
|
+
<p><a class="source-toggle" href="#"
|
581
|
+
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
582
|
+
<div class="method-source-code" id="M000016-source">
|
583
|
+
<pre>
|
584
|
+
<span class="ruby-comment cmt"># File lib/capcode.rb, line 221</span>
|
585
|
+
221: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">static</span>
|
586
|
+
222: {
|
587
|
+
223: <span class="ruby-identifier">:uri</span> =<span class="ruby-operator">></span> <span class="ruby-constant">Capcode</span>.<span class="ruby-identifier">static</span>,
|
588
|
+
224: <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> ) )
|
589
|
+
225: }
|
590
|
+
226: <span class="ruby-keyword kw">end</span>
|
591
|
+
</pre>
|
592
|
+
</div>
|
593
|
+
</div>
|
594
|
+
</div>
|
595
|
+
|
596
|
+
|
597
|
+
</div>
|
598
|
+
|
599
|
+
|
600
|
+
</div>
|
601
|
+
|
602
|
+
|
603
|
+
<div id="validator-badges">
|
604
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
605
|
+
</div>
|
606
|
+
|
607
|
+
</body>
|
608
|
+
</html>
|