frivol 0.1.3 → 0.1.4
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 +64 -3
- data/Rakefile +3 -1
- data/VERSION +1 -1
- data/doc/classes/Frivol.html +303 -0
- data/doc/classes/Frivol.src/M000003.html +22 -0
- data/doc/classes/Frivol.src/M000004.html +23 -0
- data/doc/classes/Frivol.src/M000005.html +19 -0
- data/doc/classes/Frivol.src/M000006.html +18 -0
- data/doc/classes/Frivol/ClassMethods.html +178 -0
- data/doc/classes/Frivol/ClassMethods.src/M000007.html +18 -0
- data/doc/classes/Frivol/ClassMethods.src/M000008.html +18 -0
- data/doc/classes/Frivol/Config.html +230 -0
- data/doc/classes/Frivol/Config.src/M000009.html +18 -0
- data/doc/classes/Frivol/Config.src/M000010.html +18 -0
- data/doc/classes/Frivol/Config.src/M000011.html +19 -0
- data/doc/classes/Time.html +191 -0
- data/doc/classes/Time.src/M000001.html +21 -0
- data/doc/classes/Time.src/M000002.html +18 -0
- data/doc/created.rid +1 -0
- data/doc/files/lib/frivol_rb.html +204 -0
- data/doc/fr_class_index.html +30 -0
- data/doc/fr_file_index.html +27 -0
- data/doc/fr_method_index.html +38 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/frivol.gemspec +33 -5
- data/lib/frivol.rb +128 -2
- data/test/fake_redis.rb +6 -0
- data/test/helper.rb +1 -1
- data/test/test_frivol.rb +10 -3
- metadata +64 -8
@@ -0,0 +1,18 @@
|
|
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>
|
7
|
+
<head>
|
8
|
+
<title>storage_key (Frivol)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/frivol.rb, line 105</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">storage_key</span>
|
15
|
+
<span class="ruby-ivar">@frivol_key</span> <span class="ruby-operator">||=</span> <span class="ruby-node">"#{self.class.name}-#{id}"</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,178 @@
|
|
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: Frivol::ClassMethods</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">Frivol::ClassMethods</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/frivol_rb.html">
|
59
|
+
lib/frivol.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
<div id="description">
|
76
|
+
<h2><a href="ClassMethods.html">Frivol::ClassMethods</a></h2>
|
77
|
+
<p>
|
78
|
+
These methods are available on the class level when <a
|
79
|
+
href="../Frivol.html">Frivol</a> is included in the class.
|
80
|
+
</p>
|
81
|
+
|
82
|
+
</div>
|
83
|
+
|
84
|
+
|
85
|
+
</div>
|
86
|
+
|
87
|
+
<div id="method-list">
|
88
|
+
<h3 class="section-bar">Methods</h3>
|
89
|
+
|
90
|
+
<div class="name-list">
|
91
|
+
<a href="#M000008">storage_expires_in</a>
|
92
|
+
<a href="#M000009">storage_expiry</a>
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
|
96
|
+
</div>
|
97
|
+
|
98
|
+
|
99
|
+
<!-- if includes -->
|
100
|
+
|
101
|
+
<div id="section">
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
<!-- if method_list -->
|
111
|
+
<div id="methods">
|
112
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
113
|
+
|
114
|
+
<div id="method-M000008" class="method-detail">
|
115
|
+
<a name="M000008"></a>
|
116
|
+
|
117
|
+
<div class="method-heading">
|
118
|
+
<a href="#M000008" class="method-signature">
|
119
|
+
<span class="method-name">storage_expires_in</span><span class="method-args">(time)</span>
|
120
|
+
</a>
|
121
|
+
</div>
|
122
|
+
|
123
|
+
<div class="method-description">
|
124
|
+
<p>
|
125
|
+
Set the storage expiry time in seconds.
|
126
|
+
</p>
|
127
|
+
<p><a class="source-toggle" href="#"
|
128
|
+
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
129
|
+
<div class="method-source-code" id="M000008-source">
|
130
|
+
<pre>
|
131
|
+
<span class="ruby-comment cmt"># File lib/frivol.rb, line 190</span>
|
132
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">storage_expires_in</span>(<span class="ruby-identifier">time</span>)
|
133
|
+
<span class="ruby-ivar">@frivol_storage_expiry</span> = <span class="ruby-identifier">time</span>
|
134
|
+
<span class="ruby-keyword kw">end</span>
|
135
|
+
</pre>
|
136
|
+
</div>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
<div id="method-M000009" class="method-detail">
|
141
|
+
<a name="M000009"></a>
|
142
|
+
|
143
|
+
<div class="method-heading">
|
144
|
+
<a href="#M000009" class="method-signature">
|
145
|
+
<span class="method-name">storage_expiry</span><span class="method-args">()</span>
|
146
|
+
</a>
|
147
|
+
</div>
|
148
|
+
|
149
|
+
<div class="method-description">
|
150
|
+
<p>
|
151
|
+
Get the storage expiry time in seconds.
|
152
|
+
</p>
|
153
|
+
<p><a class="source-toggle" href="#"
|
154
|
+
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
155
|
+
<div class="method-source-code" id="M000009-source">
|
156
|
+
<pre>
|
157
|
+
<span class="ruby-comment cmt"># File lib/frivol.rb, line 195</span>
|
158
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">storage_expiry</span>
|
159
|
+
<span class="ruby-ivar">@frivol_storage_expiry</span>
|
160
|
+
<span class="ruby-keyword kw">end</span>
|
161
|
+
</pre>
|
162
|
+
</div>
|
163
|
+
</div>
|
164
|
+
</div>
|
165
|
+
|
166
|
+
|
167
|
+
</div>
|
168
|
+
|
169
|
+
|
170
|
+
</div>
|
171
|
+
|
172
|
+
|
173
|
+
<div id="validator-badges">
|
174
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
175
|
+
</div>
|
176
|
+
|
177
|
+
</body>
|
178
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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>
|
7
|
+
<head>
|
8
|
+
<title>storage_expires_in (Frivol::ClassMethods)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/frivol.rb, line 169</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">storage_expires_in</span>(<span class="ruby-identifier">time</span>)
|
15
|
+
<span class="ruby-ivar">@frivol_storage_expiry</span> = <span class="ruby-identifier">time</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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>
|
7
|
+
<head>
|
8
|
+
<title>storage_expiry (Frivol::ClassMethods)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/frivol.rb, line 174</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">storage_expiry</span>
|
15
|
+
<span class="ruby-ivar">@frivol_storage_expiry</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,230 @@
|
|
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: Frivol::Config</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">Frivol::Config</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/frivol_rb.html">
|
59
|
+
lib/frivol.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
<div id="description">
|
76
|
+
<h2><a href="Config.html">Frivol::Config</a></h2>
|
77
|
+
<p>
|
78
|
+
Sets the <a href="../Frivol.html">Frivol</a> configuration (currently only
|
79
|
+
the Redis config), allows access to the configured Redis instance, and has
|
80
|
+
a helper method to include <a href="../Frivol.html">Frivol</a> in a class
|
81
|
+
with an optional storage expiry parameter
|
82
|
+
</p>
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
<div id="method-list">
|
90
|
+
<h3 class="section-bar">Methods</h3>
|
91
|
+
|
92
|
+
<div class="name-list">
|
93
|
+
<a href="#M000012">include_in</a>
|
94
|
+
<a href="#M000011">redis</a>
|
95
|
+
<a href="#M000010">redis_config=</a>
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
|
99
|
+
</div>
|
100
|
+
|
101
|
+
|
102
|
+
<!-- if includes -->
|
103
|
+
|
104
|
+
<div id="section">
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
<!-- if method_list -->
|
114
|
+
<div id="methods">
|
115
|
+
<h3 class="section-bar">Public Class methods</h3>
|
116
|
+
|
117
|
+
<div id="method-M000012" class="method-detail">
|
118
|
+
<a name="M000012"></a>
|
119
|
+
|
120
|
+
<div class="method-heading">
|
121
|
+
<a href="#M000012" class="method-signature">
|
122
|
+
<span class="method-name">include_in</span><span class="method-args">(host_class, storage_expires_in = nil)</span>
|
123
|
+
</a>
|
124
|
+
</div>
|
125
|
+
|
126
|
+
<div class="method-description">
|
127
|
+
<p>
|
128
|
+
A convenience method to include <a href="../Frivol.html">Frivol</a> in a
|
129
|
+
class, with an optional storage expiry parameter.
|
130
|
+
</p>
|
131
|
+
<p>
|
132
|
+
For example, you might have the following in environment.rb:
|
133
|
+
</p>
|
134
|
+
<pre>
|
135
|
+
Frivol::Config.redis_config = REDIS_CONFIG
|
136
|
+
Frivol::Config.include_in ActiveRecord::Base, 600
|
137
|
+
</pre>
|
138
|
+
<p>
|
139
|
+
Which would include <a href="../Frivol.html">Frivol</a> in
|
140
|
+
ActiveRecord::Base and set the default storage expiry to 10 minutes
|
141
|
+
</p>
|
142
|
+
<p><a class="source-toggle" href="#"
|
143
|
+
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
144
|
+
<div class="method-source-code" id="M000012-source">
|
145
|
+
<pre>
|
146
|
+
<span class="ruby-comment cmt"># File lib/frivol.rb, line 151</span>
|
147
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">include_in</span>(<span class="ruby-identifier">host_class</span>, <span class="ruby-identifier">storage_expires_in</span> = <span class="ruby-keyword kw">nil</span>)
|
148
|
+
<span class="ruby-identifier">host_class</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:include</span>, <span class="ruby-constant">Frivol</span>)
|
149
|
+
<span class="ruby-identifier">host_class</span>.<span class="ruby-identifier">storage_expires_in</span> <span class="ruby-identifier">storage_expires_in</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">storage_expires_in</span>
|
150
|
+
<span class="ruby-keyword kw">end</span>
|
151
|
+
</pre>
|
152
|
+
</div>
|
153
|
+
</div>
|
154
|
+
</div>
|
155
|
+
|
156
|
+
<div id="method-M000011" class="method-detail">
|
157
|
+
<a name="M000011"></a>
|
158
|
+
|
159
|
+
<div class="method-heading">
|
160
|
+
<a href="#M000011" class="method-signature">
|
161
|
+
<span class="method-name">redis</span><span class="method-args">()</span>
|
162
|
+
</a>
|
163
|
+
</div>
|
164
|
+
|
165
|
+
<div class="method-description">
|
166
|
+
<p>
|
167
|
+
Returns the configured Redis instance
|
168
|
+
</p>
|
169
|
+
<p><a class="source-toggle" href="#"
|
170
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
171
|
+
<div class="method-source-code" id="M000011-source">
|
172
|
+
<pre>
|
173
|
+
<span class="ruby-comment cmt"># File lib/frivol.rb, line 141</span>
|
174
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">redis</span>
|
175
|
+
<span class="ruby-ivar">@@redis</span>
|
176
|
+
<span class="ruby-keyword kw">end</span>
|
177
|
+
</pre>
|
178
|
+
</div>
|
179
|
+
</div>
|
180
|
+
</div>
|
181
|
+
|
182
|
+
<div id="method-M000010" class="method-detail">
|
183
|
+
<a name="M000010"></a>
|
184
|
+
|
185
|
+
<div class="method-heading">
|
186
|
+
<a href="#M000010" class="method-signature">
|
187
|
+
<span class="method-name">redis_config=</span><span class="method-args">(config)</span>
|
188
|
+
</a>
|
189
|
+
</div>
|
190
|
+
|
191
|
+
<div class="method-description">
|
192
|
+
<p>
|
193
|
+
Set the Redis configuration.
|
194
|
+
</p>
|
195
|
+
<p>
|
196
|
+
Expects a hash such as
|
197
|
+
</p>
|
198
|
+
<pre>
|
199
|
+
REDIS_CONFIG = {
|
200
|
+
:host => "localhost",
|
201
|
+
:port => 6379
|
202
|
+
}
|
203
|
+
Frivol::Config.redis_config = REDIS_CONFIG
|
204
|
+
</pre>
|
205
|
+
<p><a class="source-toggle" href="#"
|
206
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
207
|
+
<div class="method-source-code" id="M000010-source">
|
208
|
+
<pre>
|
209
|
+
<span class="ruby-comment cmt"># File lib/frivol.rb, line 136</span>
|
210
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">redis_config=</span>(<span class="ruby-identifier">config</span>)
|
211
|
+
<span class="ruby-ivar">@@redis</span> = <span class="ruby-constant">Redis</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">config</span>)
|
212
|
+
<span class="ruby-keyword kw">end</span>
|
213
|
+
</pre>
|
214
|
+
</div>
|
215
|
+
</div>
|
216
|
+
</div>
|
217
|
+
|
218
|
+
|
219
|
+
</div>
|
220
|
+
|
221
|
+
|
222
|
+
</div>
|
223
|
+
|
224
|
+
|
225
|
+
<div id="validator-badges">
|
226
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
227
|
+
</div>
|
228
|
+
|
229
|
+
</body>
|
230
|
+
</html>
|