serverside 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +16 -0
- data/Rakefile +16 -1
- data/lib/serverside/caching.rb +56 -0
- data/lib/serverside/request.rb +8 -4
- data/lib/serverside/static.rb +29 -51
- data/test/functional/static_server.rb +7 -0
- data/test/spec/caching_spec.rb +101 -0
- data/test/spec/connection_spec.rb +0 -2
- data/test/unit/request_test.rb +31 -1
- data/test/unit/static_test.rb +21 -25
- metadata +30 -75
- data/doc/rdoc/classes/Daemon/Base.html +0 -148
- data/doc/rdoc/classes/Daemon/Cluster/PidFile.html +0 -230
- data/doc/rdoc/classes/Daemon/Cluster.html +0 -308
- data/doc/rdoc/classes/Daemon/PidFile.html +0 -178
- data/doc/rdoc/classes/Daemon.html +0 -253
- data/doc/rdoc/classes/Object.html +0 -151
- data/doc/rdoc/classes/Proc.html +0 -151
- data/doc/rdoc/classes/ServerSide/Application.html +0 -172
- data/doc/rdoc/classes/ServerSide/HTTP/Connection.html +0 -202
- data/doc/rdoc/classes/ServerSide/HTTP/Request.html +0 -768
- data/doc/rdoc/classes/ServerSide/HTTP/Server.html +0 -164
- data/doc/rdoc/classes/ServerSide/HTTP.html +0 -121
- data/doc/rdoc/classes/ServerSide/Router.html +0 -496
- data/doc/rdoc/classes/ServerSide/StaticFiles/Const.html +0 -204
- data/doc/rdoc/classes/ServerSide/StaticFiles.html +0 -282
- data/doc/rdoc/classes/ServerSide/Template.html +0 -200
- data/doc/rdoc/classes/ServerSide.html +0 -174
- data/doc/rdoc/classes/String.html +0 -212
- data/doc/rdoc/classes/Symbol.html +0 -158
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/CHANGELOG.html +0 -356
- data/doc/rdoc/files/COPYING.html +0 -129
- data/doc/rdoc/files/README.html +0 -199
- data/doc/rdoc/files/lib/serverside/application_rb.html +0 -109
- data/doc/rdoc/files/lib/serverside/cluster_rb.html +0 -101
- data/doc/rdoc/files/lib/serverside/connection_rb.html +0 -101
- data/doc/rdoc/files/lib/serverside/core_ext_rb.html +0 -107
- data/doc/rdoc/files/lib/serverside/daemon_rb.html +0 -108
- data/doc/rdoc/files/lib/serverside/request_rb.html +0 -108
- data/doc/rdoc/files/lib/serverside/routing_rb.html +0 -101
- data/doc/rdoc/files/lib/serverside/server_rb.html +0 -108
- data/doc/rdoc/files/lib/serverside/static_rb.html +0 -108
- data/doc/rdoc/files/lib/serverside/template_rb.html +0 -108
- data/doc/rdoc/files/lib/serverside_rb.html +0 -131
- data/doc/rdoc/fr_class_index.html +0 -45
- data/doc/rdoc/fr_file_index.html +0 -40
- data/doc/rdoc/fr_method_index.html +0 -79
- data/doc/rdoc/index.html +0 -24
- data/doc/rdoc/rdoc-style.css +0 -208
@@ -1,200 +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: ServerSide::Template</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">ServerSide::Template</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../files/lib/serverside/template_rb.html">
|
59
|
-
lib/serverside/template.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
<tr class="top-aligned-row">
|
66
|
-
<td><strong>Parent:</strong></td>
|
67
|
-
<td>
|
68
|
-
<a href="../Object.html">
|
69
|
-
Object
|
70
|
-
</a>
|
71
|
-
</td>
|
72
|
-
</tr>
|
73
|
-
</table>
|
74
|
-
</div>
|
75
|
-
<!-- banner header -->
|
76
|
-
|
77
|
-
<div id="bodyContent">
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
<div id="contextContent">
|
82
|
-
|
83
|
-
<div id="description">
|
84
|
-
<p>
|
85
|
-
The <a href="Template.html">Template</a> module implements an ERB template
|
86
|
-
rendering system. Templates are cached and automatically reloaded if the
|
87
|
-
file changes.
|
88
|
-
</p>
|
89
|
-
|
90
|
-
</div>
|
91
|
-
|
92
|
-
|
93
|
-
</div>
|
94
|
-
|
95
|
-
<div id="method-list">
|
96
|
-
<h3 class="section-bar">Methods</h3>
|
97
|
-
|
98
|
-
<div class="name-list">
|
99
|
-
<a href="#M000043">render</a>
|
100
|
-
<a href="#M000042">set</a>
|
101
|
-
</div>
|
102
|
-
</div>
|
103
|
-
|
104
|
-
</div>
|
105
|
-
|
106
|
-
|
107
|
-
<!-- if includes -->
|
108
|
-
|
109
|
-
<div id="section">
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
<!-- if method_list -->
|
119
|
-
<div id="methods">
|
120
|
-
<h3 class="section-bar">Public Class methods</h3>
|
121
|
-
|
122
|
-
<div id="method-M000043" class="method-detail">
|
123
|
-
<a name="M000043"></a>
|
124
|
-
|
125
|
-
<div class="method-heading">
|
126
|
-
<a href="#M000043" class="method-signature">
|
127
|
-
<span class="method-name">render</span><span class="method-args">(name, binding)</span>
|
128
|
-
</a>
|
129
|
-
</div>
|
130
|
-
|
131
|
-
<div class="method-description">
|
132
|
-
<p>
|
133
|
-
Renders a template. If the template name is not found, attemps to load the
|
134
|
-
template from file. If the template has a non-nil stamp, the render method
|
135
|
-
compares it to the file stamp, and reloads the template content if
|
136
|
-
necessary.
|
137
|
-
</p>
|
138
|
-
<p><a class="source-toggle" href="#"
|
139
|
-
onclick="toggleCode('M000043-source');return false;">[Source]</a></p>
|
140
|
-
<div class="method-source-code" id="M000043-source">
|
141
|
-
<pre>
|
142
|
-
<span class="ruby-comment cmt"># File lib/serverside/template.rb, line 22</span>
|
143
|
-
22: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">render</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">binding</span>)
|
144
|
-
23: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@@templates</span>[<span class="ruby-identifier">name</span>]
|
145
|
-
24: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">t</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">result</span>(<span class="ruby-identifier">binding</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">t</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">t</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">nil?</span>
|
146
|
-
25:
|
147
|
-
26: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">name</span>)
|
148
|
-
27: <span class="ruby-identifier">stamp</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">mtime</span>(<span class="ruby-identifier">name</span>)
|
149
|
-
28: <span class="ruby-identifier">t</span> = <span class="ruby-identifier">set</span>(<span class="ruby-identifier">name</span>, <span class="ruby-constant">IO</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">name</span>), <span class="ruby-identifier">stamp</span>) <span class="ruby-keyword kw">if</span> (<span class="ruby-operator">!</span><span class="ruby-identifier">t</span> <span class="ruby-operator">||</span> (<span class="ruby-identifier">stamp</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">t</span>[<span class="ruby-value">0</span>]))
|
150
|
-
29: <span class="ruby-identifier">t</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">result</span>(<span class="ruby-identifier">binding</span>)
|
151
|
-
30: <span class="ruby-keyword kw">else</span>
|
152
|
-
31: <span class="ruby-ivar">@@templates</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-keyword kw">nil</span>
|
153
|
-
32: <span class="ruby-identifier">raise</span> <span class="ruby-constant">RuntimeError</span>, <span class="ruby-value str">'Template not found.'</span>
|
154
|
-
33: <span class="ruby-keyword kw">end</span>
|
155
|
-
34: <span class="ruby-keyword kw">end</span>
|
156
|
-
</pre>
|
157
|
-
</div>
|
158
|
-
</div>
|
159
|
-
</div>
|
160
|
-
|
161
|
-
<div id="method-M000042" class="method-detail">
|
162
|
-
<a name="M000042"></a>
|
163
|
-
|
164
|
-
<div class="method-heading">
|
165
|
-
<a href="#M000042" class="method-signature">
|
166
|
-
<span class="method-name">set</span><span class="method-args">(name, body, stamp = nil)</span>
|
167
|
-
</a>
|
168
|
-
</div>
|
169
|
-
|
170
|
-
<div class="method-description">
|
171
|
-
<p>
|
172
|
-
Stores a template for later use. The stamp parameter is used only when the
|
173
|
-
content of a template file is stored.
|
174
|
-
</p>
|
175
|
-
<p><a class="source-toggle" href="#"
|
176
|
-
onclick="toggleCode('M000042-source');return false;">[Source]</a></p>
|
177
|
-
<div class="method-source-code" id="M000042-source">
|
178
|
-
<pre>
|
179
|
-
<span class="ruby-comment cmt"># File lib/serverside/template.rb, line 14</span>
|
180
|
-
14: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">body</span>, <span class="ruby-identifier">stamp</span> = <span class="ruby-keyword kw">nil</span>)
|
181
|
-
15: <span class="ruby-ivar">@@templates</span>[<span class="ruby-identifier">name</span>] = [<span class="ruby-identifier">stamp</span>, <span class="ruby-constant">ERB</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">body</span>)]
|
182
|
-
16: <span class="ruby-keyword kw">end</span>
|
183
|
-
</pre>
|
184
|
-
</div>
|
185
|
-
</div>
|
186
|
-
</div>
|
187
|
-
|
188
|
-
|
189
|
-
</div>
|
190
|
-
|
191
|
-
|
192
|
-
</div>
|
193
|
-
|
194
|
-
|
195
|
-
<div id="validator-badges">
|
196
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
197
|
-
</div>
|
198
|
-
|
199
|
-
</body>
|
200
|
-
</html>
|
@@ -1,174 +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: ServerSide</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">ServerSide</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../files/lib/serverside_rb.html">
|
59
|
-
lib/serverside.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
<a href="../files/lib/serverside/server_rb.html">
|
63
|
-
lib/serverside/server.rb
|
64
|
-
</a>
|
65
|
-
<br />
|
66
|
-
<a href="../files/lib/serverside/application_rb.html">
|
67
|
-
lib/serverside/application.rb
|
68
|
-
</a>
|
69
|
-
<br />
|
70
|
-
<a href="../files/lib/serverside/connection_rb.html">
|
71
|
-
lib/serverside/connection.rb
|
72
|
-
</a>
|
73
|
-
<br />
|
74
|
-
<a href="../files/lib/serverside/static_rb.html">
|
75
|
-
lib/serverside/static.rb
|
76
|
-
</a>
|
77
|
-
<br />
|
78
|
-
<a href="../files/lib/serverside/routing_rb.html">
|
79
|
-
lib/serverside/routing.rb
|
80
|
-
</a>
|
81
|
-
<br />
|
82
|
-
<a href="../files/lib/serverside/template_rb.html">
|
83
|
-
lib/serverside/template.rb
|
84
|
-
</a>
|
85
|
-
<br />
|
86
|
-
<a href="../files/lib/serverside/request_rb.html">
|
87
|
-
lib/serverside/request.rb
|
88
|
-
</a>
|
89
|
-
<br />
|
90
|
-
</td>
|
91
|
-
</tr>
|
92
|
-
|
93
|
-
</table>
|
94
|
-
</div>
|
95
|
-
<!-- banner header -->
|
96
|
-
|
97
|
-
<div id="bodyContent">
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
<div id="contextContent">
|
102
|
-
|
103
|
-
<div id="description">
|
104
|
-
<p>
|
105
|
-
<a href="ServerSide.html">ServerSide</a> is a web framework that make it
|
106
|
-
easy to create custom light-weight web applications. It contains the
|
107
|
-
following functionalities:
|
108
|
-
</p>
|
109
|
-
<ol>
|
110
|
-
<li>A fast multithreaded <a href="ServerSide/HTTP.html">HTTP</a> server with
|
111
|
-
support for persistent connections
|
112
|
-
|
113
|
-
</li>
|
114
|
-
</ol>
|
115
|
-
<p>
|
116
|
-
and streaming.
|
117
|
-
</p>
|
118
|
-
<ol>
|
119
|
-
<li>A static file handler.
|
120
|
-
|
121
|
-
</li>
|
122
|
-
<li>A daemon for controlling a server or a cluster of servers.
|
123
|
-
|
124
|
-
</li>
|
125
|
-
<li>A simple script for serving files or applications easily.
|
126
|
-
|
127
|
-
</li>
|
128
|
-
<li>A simple controller-view system for processing requests.
|
129
|
-
|
130
|
-
</li>
|
131
|
-
</ol>
|
132
|
-
|
133
|
-
</div>
|
134
|
-
|
135
|
-
|
136
|
-
</div>
|
137
|
-
|
138
|
-
|
139
|
-
</div>
|
140
|
-
|
141
|
-
|
142
|
-
<!-- if includes -->
|
143
|
-
|
144
|
-
<div id="section">
|
145
|
-
|
146
|
-
<div id="class-list">
|
147
|
-
<h3 class="section-bar">Classes and Modules</h3>
|
148
|
-
|
149
|
-
Module <a href="ServerSide/Application.html" class="link">ServerSide::Application</a><br />
|
150
|
-
Module <a href="ServerSide/HTTP.html" class="link">ServerSide::HTTP</a><br />
|
151
|
-
Module <a href="ServerSide/StaticFiles.html" class="link">ServerSide::StaticFiles</a><br />
|
152
|
-
Class <a href="ServerSide/Router.html" class="link">ServerSide::Router</a><br />
|
153
|
-
Class <a href="ServerSide/Template.html" class="link">ServerSide::Template</a><br />
|
154
|
-
|
155
|
-
</div>
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
<!-- if method_list -->
|
164
|
-
|
165
|
-
|
166
|
-
</div>
|
167
|
-
|
168
|
-
|
169
|
-
<div id="validator-badges">
|
170
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
171
|
-
</div>
|
172
|
-
|
173
|
-
</body>
|
174
|
-
</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/serverside/core_ext_rb.html">
|
59
|
-
lib/serverside/core_ext.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
<tr class="top-aligned-row">
|
66
|
-
<td><strong>Parent:</strong></td>
|
67
|
-
<td>
|
68
|
-
<a href="Object.html">
|
69
|
-
Object
|
70
|
-
</a>
|
71
|
-
</td>
|
72
|
-
</tr>
|
73
|
-
</table>
|
74
|
-
</div>
|
75
|
-
<!-- banner header -->
|
76
|
-
|
77
|
-
<div id="bodyContent">
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
<div id="contextContent">
|
82
|
-
|
83
|
-
<div id="description">
|
84
|
-
<p>
|
85
|
-
<a href="String.html">String</a> extension methods.
|
86
|
-
</p>
|
87
|
-
|
88
|
-
</div>
|
89
|
-
|
90
|
-
|
91
|
-
</div>
|
92
|
-
|
93
|
-
<div id="method-list">
|
94
|
-
<h3 class="section-bar">Methods</h3>
|
95
|
-
|
96
|
-
<div class="name-list">
|
97
|
-
<a href="#M000006">/</a>
|
98
|
-
<a href="#M000004">uri_escape</a>
|
99
|
-
<a href="#M000005">uri_unescape</a>
|
100
|
-
</div>
|
101
|
-
</div>
|
102
|
-
|
103
|
-
</div>
|
104
|
-
|
105
|
-
|
106
|
-
<!-- if includes -->
|
107
|
-
|
108
|
-
<div id="section">
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
<!-- if method_list -->
|
118
|
-
<div id="methods">
|
119
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
120
|
-
|
121
|
-
<div id="method-M000006" class="method-detail">
|
122
|
-
<a name="M000006"></a>
|
123
|
-
|
124
|
-
<div class="method-heading">
|
125
|
-
<a href="#M000006" class="method-signature">
|
126
|
-
<span class="method-name">/</span><span class="method-args">(o)</span>
|
127
|
-
</a>
|
128
|
-
</div>
|
129
|
-
|
130
|
-
<div class="method-description">
|
131
|
-
<p>
|
132
|
-
Concatenates a path (do we really need this sugar?)
|
133
|
-
</p>
|
134
|
-
<p><a class="source-toggle" href="#"
|
135
|
-
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
136
|
-
<div class="method-source-code" id="M000006-source">
|
137
|
-
<pre>
|
138
|
-
<span class="ruby-comment cmt"># File lib/serverside/core_ext.rb, line 15</span>
|
139
|
-
15: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">/</span>(<span class="ruby-identifier">o</span>)
|
140
|
-
16: <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">o</span>.<span class="ruby-identifier">to_s</span>)
|
141
|
-
17: <span class="ruby-keyword kw">end</span>
|
142
|
-
</pre>
|
143
|
-
</div>
|
144
|
-
</div>
|
145
|
-
</div>
|
146
|
-
|
147
|
-
<div id="method-M000004" class="method-detail">
|
148
|
-
<a name="M000004"></a>
|
149
|
-
|
150
|
-
<div class="method-heading">
|
151
|
-
<a href="#M000004" class="method-signature">
|
152
|
-
<span class="method-name">uri_escape</span><span class="method-args">()</span>
|
153
|
-
</a>
|
154
|
-
</div>
|
155
|
-
|
156
|
-
<div class="method-description">
|
157
|
-
<p>
|
158
|
-
Encodes a normal string to a URI string.
|
159
|
-
</p>
|
160
|
-
<p><a class="source-toggle" href="#"
|
161
|
-
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
162
|
-
<div class="method-source-code" id="M000004-source">
|
163
|
-
<pre>
|
164
|
-
<span class="ruby-comment cmt"># File lib/serverside/core_ext.rb, line 4</span>
|
165
|
-
4: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">uri_escape</span>
|
166
|
-
5: <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([^ a-zA-Z0-9_.-]+)/n</span>) {<span class="ruby-value str">'%'</span><span class="ruby-operator">+</span><span class="ruby-identifier">$1</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">'H2'</span><span class="ruby-operator">*</span><span class="ruby-identifier">$1</span>.<span class="ruby-identifier">size</span>).
|
167
|
-
6: <span class="ruby-identifier">join</span>(<span class="ruby-value str">'%'</span>).<span class="ruby-identifier">upcase</span>}.<span class="ruby-identifier">tr</span>(<span class="ruby-value str">' '</span>, <span class="ruby-value str">'+'</span>)
|
168
|
-
7: <span class="ruby-keyword kw">end</span>
|
169
|
-
</pre>
|
170
|
-
</div>
|
171
|
-
</div>
|
172
|
-
</div>
|
173
|
-
|
174
|
-
<div id="method-M000005" class="method-detail">
|
175
|
-
<a name="M000005"></a>
|
176
|
-
|
177
|
-
<div class="method-heading">
|
178
|
-
<a href="#M000005" class="method-signature">
|
179
|
-
<span class="method-name">uri_unescape</span><span class="method-args">()</span>
|
180
|
-
</a>
|
181
|
-
</div>
|
182
|
-
|
183
|
-
<div class="method-description">
|
184
|
-
<p>
|
185
|
-
Decodes a URI string to a normal string.
|
186
|
-
</p>
|
187
|
-
<p><a class="source-toggle" href="#"
|
188
|
-
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
189
|
-
<div class="method-source-code" id="M000005-source">
|
190
|
-
<pre>
|
191
|
-
<span class="ruby-comment cmt"># File lib/serverside/core_ext.rb, line 10</span>
|
192
|
-
10: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">uri_unescape</span>
|
193
|
-
11: <span class="ruby-identifier">tr</span>(<span class="ruby-value str">'+'</span>, <span class="ruby-value str">' '</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/((?:%[0-9a-fA-F]{2})+)/n</span>){[<span class="ruby-identifier">$1</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">'%'</span>)].<span class="ruby-identifier">pack</span>(<span class="ruby-value str">'H*'</span>)}
|
194
|
-
12: <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>
|