redis_object 0.5.0 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +0 -2
- data/Gemfile +0 -4
- data/README.markdown +15 -24
- data/Rakefile +0 -8
- data/doc/Object.html +185 -0
- data/doc/Seabright.html +181 -0
- data/doc/Seabright/Adapter.html +442 -0
- data/doc/Seabright/Collection.html +797 -0
- data/doc/Seabright/Collections.html +635 -0
- data/doc/Seabright/Collections/ClassMethods.html +212 -0
- data/doc/Seabright/ExternalIndex.html +217 -0
- data/doc/Seabright/History.html +382 -0
- data/doc/Seabright/History/ClassMethods.html +276 -0
- data/doc/Seabright/Indices.html +324 -0
- data/doc/Seabright/Indices/ClassMethods.html +348 -0
- data/doc/Seabright/Keys.html +314 -0
- data/doc/Seabright/Keys/ClassMethods.html +276 -0
- data/doc/Seabright/ObjectBase.html +852 -0
- data/doc/Seabright/ObjectBase/ClassMethods.html +677 -0
- data/doc/Seabright/RedisObject.html +230 -0
- data/doc/Seabright/References.html +280 -0
- data/doc/Seabright/Storage.html +252 -0
- data/doc/Seabright/Storage/ClassMethods.html +276 -0
- data/doc/Seabright/Storage/MySQL.html +442 -0
- data/doc/Seabright/Storage/Redis.html +218 -0
- data/doc/Seabright/Template.html +212 -0
- data/doc/Seabright/Template/ClassMethods.html +166 -0
- data/doc/Seabright/Timestamps.html +292 -0
- data/doc/Seabright/Timestamps/ClassMethods.html +214 -0
- data/doc/Seabright/Types.html +410 -0
- data/doc/Seabright/Types/ClassMethods.html +308 -0
- data/doc/created.rid +17 -0
- data/doc/images/add.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +125 -0
- data/doc/js/darkfish.js +153 -0
- data/doc/js/jquery.js +18 -0
- data/doc/js/navigation.js +142 -0
- data/doc/js/search.js +94 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/searcher.js +228 -0
- data/doc/rdoc.css +543 -0
- data/doc/table_of_contents.html +394 -0
- data/lib/redis_object.rb +1 -11
- data/lib/redis_object/base.rb +60 -210
- data/lib/redis_object/collection.rb +100 -130
- data/lib/redis_object/defaults.rb +8 -21
- data/lib/redis_object/ext/filters.rb +16 -34
- data/lib/redis_object/ext/triggers.rb +13 -75
- data/lib/redis_object/{experimental/history.rb → history.rb} +0 -0
- data/lib/redis_object/indices.rb +39 -44
- data/lib/redis_object/keys.rb +4 -4
- data/lib/redis_object/storage.rb +1 -30
- data/lib/redis_object/storage/adapter.rb +3 -6
- data/lib/redis_object/storage/redis.rb +3 -98
- data/lib/redis_object/timestamps.rb +21 -42
- data/lib/redis_object/types.rb +30 -172
- data/lib/redis_object/version.rb +1 -1
- data/redis_object.gemspec +0 -1
- data/spec/base_spec.rb +6 -41
- data/spec/spec_helper.rb +1 -32
- metadata +116 -111
- data/.coveralls.yml +0 -1
- data/.travis.yml +0 -5
- data/lib/redis_object/ext/script_cache.rb +0 -92
- data/lib/redis_object/ext/shardable.rb +0 -18
- data/lib/redis_object/ext/view_caching.rb +0 -258
- data/lib/redis_object/ext/views.rb +0 -102
- data/lib/redis_object/inheritance_tracking.rb +0 -23
- data/spec/adapter_spec.rb +0 -43
- data/spec/benchmark_spec.rb +0 -46
- data/spec/collections_spec.rb +0 -144
- data/spec/defaults_spec.rb +0 -56
- data/spec/filters_spec.rb +0 -29
- data/spec/indices_spec.rb +0 -45
- data/spec/rename_class_spec.rb +0 -96
- data/spec/timestamp_spec.rb +0 -28
- data/spec/trigger_spec.rb +0 -51
- data/spec/types_spec.rb +0 -103
- data/spec/view_caching_spec.rb +0 -130
- data/spec/views_spec.rb +0 -72
@@ -0,0 +1,276 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>module Seabright::Keys::ClassMethods - StubbornObject</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "../../";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="../../js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="../../js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="../../js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="../../js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="../../js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body id="top" class="module">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="../../index.html">Home</a>
|
28
|
+
<a href="../../table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="../../table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="file-metadata">
|
47
|
+
<nav id="file-list-section" class="section">
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
49
|
+
<ul>
|
50
|
+
<li>lib/redis_object/keys.rb
|
51
|
+
</ul>
|
52
|
+
</nav>
|
53
|
+
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<div id="class-metadata">
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
<!-- Method Quickref -->
|
62
|
+
<nav id="method-list-section" class="section">
|
63
|
+
<h3 class="section-header">Methods</h3>
|
64
|
+
|
65
|
+
<ul class="link-list">
|
66
|
+
|
67
|
+
<li><a href="#method-i-hkey">#hkey</a>
|
68
|
+
|
69
|
+
<li><a href="#method-i-key">#key</a>
|
70
|
+
|
71
|
+
<li><a href="#method-i-reserve_key">#reserve_key</a>
|
72
|
+
|
73
|
+
</ul>
|
74
|
+
</nav>
|
75
|
+
|
76
|
+
</div>
|
77
|
+
|
78
|
+
<div id="project-metadata">
|
79
|
+
|
80
|
+
<nav id="classindex-section" class="section project-section">
|
81
|
+
<h3 class="section-header">Class and Module Index</h3>
|
82
|
+
|
83
|
+
<ul class="link-list">
|
84
|
+
|
85
|
+
<li><a href="../../Seabright.html">Seabright</a>
|
86
|
+
|
87
|
+
<li><a href="../../Seabright/Adapter.html">Seabright::Adapter</a>
|
88
|
+
|
89
|
+
<li><a href="../../Seabright/Collection.html">Seabright::Collection</a>
|
90
|
+
|
91
|
+
<li><a href="../../Seabright/Collections.html">Seabright::Collections</a>
|
92
|
+
|
93
|
+
<li><a href="../../Seabright/Collections/ClassMethods.html">Seabright::Collections::ClassMethods</a>
|
94
|
+
|
95
|
+
<li><a href="../../Seabright/ExternalIndex.html">Seabright::ExternalIndex</a>
|
96
|
+
|
97
|
+
<li><a href="../../Seabright/History.html">Seabright::History</a>
|
98
|
+
|
99
|
+
<li><a href="../../Seabright/History/ClassMethods.html">Seabright::History::ClassMethods</a>
|
100
|
+
|
101
|
+
<li><a href="../../Seabright/Indices.html">Seabright::Indices</a>
|
102
|
+
|
103
|
+
<li><a href="../../Seabright/Indices/ClassMethods.html">Seabright::Indices::ClassMethods</a>
|
104
|
+
|
105
|
+
<li><a href="../../Seabright/Keys.html">Seabright::Keys</a>
|
106
|
+
|
107
|
+
<li><a href="../../Seabright/Keys/ClassMethods.html">Seabright::Keys::ClassMethods</a>
|
108
|
+
|
109
|
+
<li><a href="../../Seabright/ObjectBase.html">Seabright::ObjectBase</a>
|
110
|
+
|
111
|
+
<li><a href="../../Seabright/ObjectBase/ClassMethods.html">Seabright::ObjectBase::ClassMethods</a>
|
112
|
+
|
113
|
+
<li><a href="../../Seabright/RedisObject.html">Seabright::RedisObject</a>
|
114
|
+
|
115
|
+
<li><a href="../../Seabright/RedisObject.html">Seabright::RedisObject</a>
|
116
|
+
|
117
|
+
<li><a href="../../Seabright/References.html">Seabright::References</a>
|
118
|
+
|
119
|
+
<li><a href="../../Seabright/Storage.html">Seabright::Storage</a>
|
120
|
+
|
121
|
+
<li><a href="../../Seabright/Storage/ClassMethods.html">Seabright::Storage::ClassMethods</a>
|
122
|
+
|
123
|
+
<li><a href="../../Seabright/Storage/MySQL.html">Seabright::Storage::MySQL</a>
|
124
|
+
|
125
|
+
<li><a href="../../Seabright/Storage/Redis.html">Seabright::Storage::Redis</a>
|
126
|
+
|
127
|
+
<li><a href="../../Seabright/Template.html">Seabright::Template</a>
|
128
|
+
|
129
|
+
<li><a href="../../Seabright/Template/ClassMethods.html">Seabright::Template::ClassMethods</a>
|
130
|
+
|
131
|
+
<li><a href="../../Seabright/Timestamps.html">Seabright::Timestamps</a>
|
132
|
+
|
133
|
+
<li><a href="../../Seabright/Timestamps/ClassMethods.html">Seabright::Timestamps::ClassMethods</a>
|
134
|
+
|
135
|
+
<li><a href="../../Seabright/Types.html">Seabright::Types</a>
|
136
|
+
|
137
|
+
<li><a href="../../Seabright/Types/ClassMethods.html">Seabright::Types::ClassMethods</a>
|
138
|
+
|
139
|
+
<li><a href="../../Object.html">Object</a>
|
140
|
+
|
141
|
+
<li><a href="../../Seabright/RedisObject.html">Object::RedisObject</a>
|
142
|
+
|
143
|
+
</ul>
|
144
|
+
</nav>
|
145
|
+
|
146
|
+
</div>
|
147
|
+
</nav>
|
148
|
+
|
149
|
+
<div id="documentation">
|
150
|
+
<h1 class="module">module Seabright::Keys::ClassMethods</h1>
|
151
|
+
|
152
|
+
<div id="description" class="description">
|
153
|
+
|
154
|
+
</div><!-- description -->
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
<!-- Methods -->
|
169
|
+
|
170
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
|
171
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
172
|
+
|
173
|
+
|
174
|
+
<div id="method-i-hkey" class="method-detail ">
|
175
|
+
|
176
|
+
<div class="method-heading">
|
177
|
+
<span class="method-name">hkey</span><span
|
178
|
+
class="method-args">(ident = id, prnt = nil)</span>
|
179
|
+
<span class="method-click-advice">click to toggle source</span>
|
180
|
+
</div>
|
181
|
+
|
182
|
+
|
183
|
+
<div class="method-description">
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
<div class="method-source-code" id="hkey-source">
|
190
|
+
<pre><span class="ruby-comment"># File lib/redis_object/keys.rb, line 26</span>
|
191
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">hkey</span>(<span class="ruby-identifier">ident</span> = <span class="ruby-identifier">id</span>, <span class="ruby-identifier">prnt</span> = <span class="ruby-keyword">nil</span>)
|
192
|
+
<span class="ruby-node">"#{key(ident,prnt)}_h"</span>
|
193
|
+
<span class="ruby-keyword">end</span></pre>
|
194
|
+
</div><!-- hkey-source -->
|
195
|
+
|
196
|
+
</div>
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
</div><!-- hkey-method -->
|
202
|
+
|
203
|
+
|
204
|
+
<div id="method-i-key" class="method-detail ">
|
205
|
+
|
206
|
+
<div class="method-heading">
|
207
|
+
<span class="method-name">key</span><span
|
208
|
+
class="method-args">(ident, prnt = nil)</span>
|
209
|
+
<span class="method-click-advice">click to toggle source</span>
|
210
|
+
</div>
|
211
|
+
|
212
|
+
|
213
|
+
<div class="method-description">
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
<div class="method-source-code" id="key-source">
|
220
|
+
<pre><span class="ruby-comment"># File lib/redis_object/keys.rb, line 18</span>
|
221
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">key</span>(<span class="ruby-identifier">ident</span>, <span class="ruby-identifier">prnt</span> = <span class="ruby-keyword">nil</span>)
|
222
|
+
<span class="ruby-node">"#{prnt ? prnt.class==String ? "#{prnt}:" : "#{prnt.key}:" : ""}#{cname}:#{ident.gsub(/^.*:/,'')}"</span>
|
223
|
+
<span class="ruby-keyword">end</span></pre>
|
224
|
+
</div><!-- key-source -->
|
225
|
+
|
226
|
+
</div>
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
</div><!-- key-method -->
|
232
|
+
|
233
|
+
|
234
|
+
<div id="method-i-reserve_key" class="method-detail ">
|
235
|
+
|
236
|
+
<div class="method-heading">
|
237
|
+
<span class="method-name">reserve_key</span><span
|
238
|
+
class="method-args">(ident, prnt = nil)</span>
|
239
|
+
<span class="method-click-advice">click to toggle source</span>
|
240
|
+
</div>
|
241
|
+
|
242
|
+
|
243
|
+
<div class="method-description">
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
<div class="method-source-code" id="reserve_key-source">
|
250
|
+
<pre><span class="ruby-comment"># File lib/redis_object/keys.rb, line 22</span>
|
251
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">reserve_key</span>(<span class="ruby-identifier">ident</span>, <span class="ruby-identifier">prnt</span> = <span class="ruby-keyword">nil</span>)
|
252
|
+
<span class="ruby-node">"#{key(ident,prnt)}_reserve"</span>
|
253
|
+
<span class="ruby-keyword">end</span></pre>
|
254
|
+
</div><!-- reserve_key-source -->
|
255
|
+
|
256
|
+
</div>
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
</div><!-- reserve_key-method -->
|
262
|
+
|
263
|
+
|
264
|
+
</section><!-- public-instance-method-details -->
|
265
|
+
|
266
|
+
</section><!-- 5Buntitled-5D -->
|
267
|
+
|
268
|
+
</div><!-- documentation -->
|
269
|
+
|
270
|
+
|
271
|
+
<footer id="validator-badges">
|
272
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
273
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
274
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
275
|
+
</footer>
|
276
|
+
|
@@ -0,0 +1,852 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>module Seabright::ObjectBase - StubbornObject</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "../";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body id="top" class="module">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="../index.html">Home</a>
|
28
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="file-metadata">
|
47
|
+
<nav id="file-list-section" class="section">
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
49
|
+
<ul>
|
50
|
+
<li>lib/redis_object/base.rb
|
51
|
+
</ul>
|
52
|
+
</nav>
|
53
|
+
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<div id="class-metadata">
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
<!-- Method Quickref -->
|
62
|
+
<nav id="method-list-section" class="section">
|
63
|
+
<h3 class="section-header">Methods</h3>
|
64
|
+
|
65
|
+
<ul class="link-list">
|
66
|
+
|
67
|
+
<li><a href="#method-c-new">::new</a>
|
68
|
+
|
69
|
+
<li><a href="#method-i-5B-5D">#[]</a>
|
70
|
+
|
71
|
+
<li><a href="#method-i-5B-5D-3D">#[]=</a>
|
72
|
+
|
73
|
+
<li><a href="#method-i-actual">#actual</a>
|
74
|
+
|
75
|
+
<li><a href="#method-i-delete-21">#delete!</a>
|
76
|
+
|
77
|
+
<li><a href="#method-i-dump">#dump</a>
|
78
|
+
|
79
|
+
<li><a href="#method-i-generate_id">#generate_id</a>
|
80
|
+
|
81
|
+
<li><a href="#method-i-get">#get</a>
|
82
|
+
|
83
|
+
<li><a href="#method-i-id">#id</a>
|
84
|
+
|
85
|
+
<li><a href="#method-i-inspect">#inspect</a>
|
86
|
+
|
87
|
+
<li><a href="#method-i-load">#load</a>
|
88
|
+
|
89
|
+
<li><a href="#method-i-new_id">#new_id</a>
|
90
|
+
|
91
|
+
<li><a href="#method-i-parent">#parent</a>
|
92
|
+
|
93
|
+
<li><a href="#method-i-parent-3D">#parent=</a>
|
94
|
+
|
95
|
+
<li><a href="#method-i-raw">#raw</a>
|
96
|
+
|
97
|
+
<li><a href="#method-i-reserve">#reserve</a>
|
98
|
+
|
99
|
+
<li><a href="#method-i-save">#save</a>
|
100
|
+
|
101
|
+
<li><a href="#method-i-set">#set</a>
|
102
|
+
|
103
|
+
<li><a href="#method-i-to_json">#to_json</a>
|
104
|
+
|
105
|
+
</ul>
|
106
|
+
</nav>
|
107
|
+
|
108
|
+
</div>
|
109
|
+
|
110
|
+
<div id="project-metadata">
|
111
|
+
|
112
|
+
<nav id="classindex-section" class="section project-section">
|
113
|
+
<h3 class="section-header">Class and Module Index</h3>
|
114
|
+
|
115
|
+
<ul class="link-list">
|
116
|
+
|
117
|
+
<li><a href="../Seabright.html">Seabright</a>
|
118
|
+
|
119
|
+
<li><a href="../Seabright/Adapter.html">Seabright::Adapter</a>
|
120
|
+
|
121
|
+
<li><a href="../Seabright/Collection.html">Seabright::Collection</a>
|
122
|
+
|
123
|
+
<li><a href="../Seabright/Collections.html">Seabright::Collections</a>
|
124
|
+
|
125
|
+
<li><a href="../Seabright/Collections/ClassMethods.html">Seabright::Collections::ClassMethods</a>
|
126
|
+
|
127
|
+
<li><a href="../Seabright/ExternalIndex.html">Seabright::ExternalIndex</a>
|
128
|
+
|
129
|
+
<li><a href="../Seabright/History.html">Seabright::History</a>
|
130
|
+
|
131
|
+
<li><a href="../Seabright/History/ClassMethods.html">Seabright::History::ClassMethods</a>
|
132
|
+
|
133
|
+
<li><a href="../Seabright/Indices.html">Seabright::Indices</a>
|
134
|
+
|
135
|
+
<li><a href="../Seabright/Indices/ClassMethods.html">Seabright::Indices::ClassMethods</a>
|
136
|
+
|
137
|
+
<li><a href="../Seabright/Keys.html">Seabright::Keys</a>
|
138
|
+
|
139
|
+
<li><a href="../Seabright/Keys/ClassMethods.html">Seabright::Keys::ClassMethods</a>
|
140
|
+
|
141
|
+
<li><a href="../Seabright/ObjectBase.html">Seabright::ObjectBase</a>
|
142
|
+
|
143
|
+
<li><a href="../Seabright/ObjectBase/ClassMethods.html">Seabright::ObjectBase::ClassMethods</a>
|
144
|
+
|
145
|
+
<li><a href="../Seabright/RedisObject.html">Seabright::RedisObject</a>
|
146
|
+
|
147
|
+
<li><a href="../Seabright/RedisObject.html">Seabright::RedisObject</a>
|
148
|
+
|
149
|
+
<li><a href="../Seabright/References.html">Seabright::References</a>
|
150
|
+
|
151
|
+
<li><a href="../Seabright/Storage.html">Seabright::Storage</a>
|
152
|
+
|
153
|
+
<li><a href="../Seabright/Storage/ClassMethods.html">Seabright::Storage::ClassMethods</a>
|
154
|
+
|
155
|
+
<li><a href="../Seabright/Storage/MySQL.html">Seabright::Storage::MySQL</a>
|
156
|
+
|
157
|
+
<li><a href="../Seabright/Storage/Redis.html">Seabright::Storage::Redis</a>
|
158
|
+
|
159
|
+
<li><a href="../Seabright/Template.html">Seabright::Template</a>
|
160
|
+
|
161
|
+
<li><a href="../Seabright/Template/ClassMethods.html">Seabright::Template::ClassMethods</a>
|
162
|
+
|
163
|
+
<li><a href="../Seabright/Timestamps.html">Seabright::Timestamps</a>
|
164
|
+
|
165
|
+
<li><a href="../Seabright/Timestamps/ClassMethods.html">Seabright::Timestamps::ClassMethods</a>
|
166
|
+
|
167
|
+
<li><a href="../Seabright/Types.html">Seabright::Types</a>
|
168
|
+
|
169
|
+
<li><a href="../Seabright/Types/ClassMethods.html">Seabright::Types::ClassMethods</a>
|
170
|
+
|
171
|
+
<li><a href="../Object.html">Object</a>
|
172
|
+
|
173
|
+
<li><a href="../Seabright/RedisObject.html">Object::RedisObject</a>
|
174
|
+
|
175
|
+
</ul>
|
176
|
+
</nav>
|
177
|
+
|
178
|
+
</div>
|
179
|
+
</nav>
|
180
|
+
|
181
|
+
<div id="documentation">
|
182
|
+
<h1 class="module">module Seabright::ObjectBase</h1>
|
183
|
+
|
184
|
+
<div id="description" class="description">
|
185
|
+
|
186
|
+
</div><!-- description -->
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
<!-- Methods -->
|
201
|
+
|
202
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
203
|
+
<h3 class="section-header">Public Class Methods</h3>
|
204
|
+
|
205
|
+
|
206
|
+
<div id="method-c-new" class="method-detail ">
|
207
|
+
|
208
|
+
<div class="method-heading">
|
209
|
+
<span class="method-name">new</span><span
|
210
|
+
class="method-args">(ident={}, prnt = nil)</span>
|
211
|
+
<span class="method-click-advice">click to toggle source</span>
|
212
|
+
</div>
|
213
|
+
|
214
|
+
|
215
|
+
<div class="method-description">
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
<div class="method-source-code" id="new-source">
|
222
|
+
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 4</span>
|
223
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">ident</span>={}, <span class="ruby-identifier">prnt</span> = <span class="ruby-keyword">nil</span>)
|
224
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">prnt</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">prnt</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">String</span>
|
225
|
+
<span class="ruby-ivar">@parent</span> = <span class="ruby-identifier">prnt</span>
|
226
|
+
<span class="ruby-ivar">@parent_id</span> = <span class="ruby-identifier">prnt</span>.<span class="ruby-identifier">hkey</span>
|
227
|
+
<span class="ruby-keyword">else</span>
|
228
|
+
<span class="ruby-ivar">@parent_id</span> = <span class="ruby-identifier">prnt</span>
|
229
|
+
<span class="ruby-keyword">end</span>
|
230
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">ident</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">ident</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">String</span>
|
231
|
+
<span class="ruby-identifier">load</span>(<span class="ruby-identifier">ident</span>)
|
232
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">ident</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">ident</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Hash</span>
|
233
|
+
<span class="ruby-identifier">ident</span>[<span class="ruby-identifier">id_sym</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">generate_id</span>
|
234
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">load</span>(<span class="ruby-identifier">ident</span>[<span class="ruby-identifier">id_sym</span>])
|
235
|
+
<span class="ruby-ivar">@data</span> = <span class="ruby-identifier">ident</span>
|
236
|
+
<span class="ruby-keyword">end</span>
|
237
|
+
<span class="ruby-keyword">end</span>
|
238
|
+
<span class="ruby-keyword">end</span></pre>
|
239
|
+
</div><!-- new-source -->
|
240
|
+
|
241
|
+
</div>
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
</div><!-- new-method -->
|
247
|
+
|
248
|
+
|
249
|
+
</section><!-- public-class-method-details -->
|
250
|
+
|
251
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
|
252
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
253
|
+
|
254
|
+
|
255
|
+
<div id="method-i-5B-5D" class="method-detail method-alias">
|
256
|
+
|
257
|
+
<div class="method-heading">
|
258
|
+
<span class="method-name">[]</span><span
|
259
|
+
class="method-args">(k)</span>
|
260
|
+
<span class="method-click-advice">click to toggle source</span>
|
261
|
+
</div>
|
262
|
+
|
263
|
+
|
264
|
+
<div class="method-description">
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
</div>
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
<div class="aliases">
|
276
|
+
Alias for: <a href="ObjectBase.html#method-i-get">get</a>
|
277
|
+
</div>
|
278
|
+
|
279
|
+
</div><!-- 5B-5D-method -->
|
280
|
+
|
281
|
+
|
282
|
+
<div id="method-i-5B-5D-3D" class="method-detail method-alias">
|
283
|
+
|
284
|
+
<div class="method-heading">
|
285
|
+
<span class="method-name">[]=</span><span
|
286
|
+
class="method-args">(k,v)</span>
|
287
|
+
<span class="method-click-advice">click to toggle source</span>
|
288
|
+
</div>
|
289
|
+
|
290
|
+
|
291
|
+
<div class="method-description">
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
</div>
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
<div class="aliases">
|
303
|
+
Alias for: <a href="ObjectBase.html#method-i-set">set</a>
|
304
|
+
</div>
|
305
|
+
|
306
|
+
</div><!-- 5B-5D-3D-method -->
|
307
|
+
|
308
|
+
|
309
|
+
<div id="method-i-actual" class="method-detail method-alias">
|
310
|
+
|
311
|
+
<div class="method-heading">
|
312
|
+
<span class="method-name">actual</span><span
|
313
|
+
class="method-args">()</span>
|
314
|
+
<span class="method-click-advice">click to toggle source</span>
|
315
|
+
</div>
|
316
|
+
|
317
|
+
|
318
|
+
<div class="method-description">
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
</div>
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
<div class="aliases">
|
330
|
+
Alias for: <a href="ObjectBase.html#method-i-raw">raw</a>
|
331
|
+
</div>
|
332
|
+
|
333
|
+
</div><!-- actual-method -->
|
334
|
+
|
335
|
+
|
336
|
+
<div id="method-i-delete-21" class="method-detail ">
|
337
|
+
|
338
|
+
<div class="method-heading">
|
339
|
+
<span class="method-name">delete!</span><span
|
340
|
+
class="method-args">()</span>
|
341
|
+
<span class="method-click-advice">click to toggle source</span>
|
342
|
+
</div>
|
343
|
+
|
344
|
+
|
345
|
+
<div class="method-description">
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
<div class="method-source-code" id="delete-21-source">
|
352
|
+
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 91</span>
|
353
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">delete!</span>
|
354
|
+
<span class="ruby-identifier">store</span>.<span class="ruby-identifier">del</span> <span class="ruby-identifier">key</span>
|
355
|
+
<span class="ruby-identifier">store</span>.<span class="ruby-identifier">del</span> <span class="ruby-identifier">hkey</span>
|
356
|
+
<span class="ruby-identifier">store</span>.<span class="ruby-identifier">srem</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">plname</span>, <span class="ruby-identifier">key</span>)
|
357
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">parent</span>
|
358
|
+
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">delete_child</span> <span class="ruby-keyword">self</span>
|
359
|
+
<span class="ruby-keyword">end</span>
|
360
|
+
<span class="ruby-identifier">store</span>.<span class="ruby-identifier">smembers</span>(<span class="ruby-identifier">ref_key</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span>
|
361
|
+
<span class="ruby-keyword">if</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">find_by_key</span>(<span class="ruby-identifier">k</span>)
|
362
|
+
|
363
|
+
<span class="ruby-keyword">end</span>
|
364
|
+
<span class="ruby-keyword">end</span>
|
365
|
+
<span class="ruby-keyword">end</span></pre>
|
366
|
+
</div><!-- delete-21-source -->
|
367
|
+
|
368
|
+
</div>
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
</div><!-- delete-21-method -->
|
374
|
+
|
375
|
+
|
376
|
+
<div id="method-i-dump" class="method-detail ">
|
377
|
+
|
378
|
+
<div class="method-heading">
|
379
|
+
<span class="method-name">dump</span><span
|
380
|
+
class="method-args">(prnt=nil)</span>
|
381
|
+
<span class="method-click-advice">click to toggle source</span>
|
382
|
+
</div>
|
383
|
+
|
384
|
+
|
385
|
+
<div class="method-description">
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
<div class="method-source-code" id="dump-source">
|
392
|
+
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 45</span>
|
393
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">dump</span>(<span class="ruby-identifier">prnt</span>=<span class="ruby-keyword">nil</span>)
|
394
|
+
<span class="ruby-identifier">require</span> <span class="ruby-string">"utf8_utils"</span>
|
395
|
+
<span class="ruby-identifier">out</span> = [<span class="ruby-node">"puts \"Creating: #{id}\""</span>]
|
396
|
+
<span class="ruby-identifier">s_id</span> = (<span class="ruby-identifier">prnt</span> <span class="ruby-operator">?</span> <span class="ruby-node">"#{prnt.id} #{id}"</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">id</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">%r\W/</span>,<span class="ruby-string">"_"</span>)
|
397
|
+
<span class="ruby-identifier">out</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"a#{s_id} = #{self.class.cname}.new(#{actual.to_s.tidy_bytes},#{prnt.id})"</span>
|
398
|
+
<span class="ruby-identifier">out</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"a#{prnt.id.gsub(/\W/,"_")} << a#{s_id}"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">prnt</span>
|
399
|
+
<span class="ruby-identifier">out</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"a#{s_id}.save"</span>
|
400
|
+
<span class="ruby-identifier">out</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">"\n"</span>)
|
401
|
+
<span class="ruby-keyword">end</span></pre>
|
402
|
+
</div><!-- dump-source -->
|
403
|
+
|
404
|
+
</div>
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
</div><!-- dump-method -->
|
410
|
+
|
411
|
+
|
412
|
+
<div id="method-i-generate_id" class="method-detail ">
|
413
|
+
|
414
|
+
<div class="method-heading">
|
415
|
+
<span class="method-name">generate_id</span><span
|
416
|
+
class="method-args">()</span>
|
417
|
+
<span class="method-click-advice">click to toggle source</span>
|
418
|
+
</div>
|
419
|
+
|
420
|
+
|
421
|
+
<div class="method-description">
|
422
|
+
|
423
|
+
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
<div class="method-source-code" id="generate_id-source">
|
428
|
+
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 25</span>
|
429
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">generate_id</span>
|
430
|
+
<span class="ruby-identifier">v</span> = <span class="ruby-identifier">new_id</span>
|
431
|
+
<span class="ruby-keyword">while</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">v</span>) <span class="ruby-keyword">do</span>
|
432
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"[RedisObject] Collision at id: #{v}"</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">DEBUG</span>
|
433
|
+
<span class="ruby-identifier">v</span> = <span class="ruby-identifier">new_id</span>
|
434
|
+
<span class="ruby-keyword">end</span>
|
435
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"[RedisObject] Reserving key: #{v}"</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">DEBUG</span>
|
436
|
+
<span class="ruby-identifier">reserve</span>(<span class="ruby-identifier">v</span>)
|
437
|
+
<span class="ruby-identifier">v</span>
|
438
|
+
<span class="ruby-keyword">end</span></pre>
|
439
|
+
</div><!-- generate_id-source -->
|
440
|
+
|
441
|
+
</div>
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
|
446
|
+
</div><!-- generate_id-method -->
|
447
|
+
|
448
|
+
|
449
|
+
<div id="method-i-get" class="method-detail ">
|
450
|
+
|
451
|
+
<div class="method-heading">
|
452
|
+
<span class="method-name">get</span><span
|
453
|
+
class="method-args">(k)</span>
|
454
|
+
<span class="method-click-advice">click to toggle source</span>
|
455
|
+
</div>
|
456
|
+
|
457
|
+
|
458
|
+
<div class="method-description">
|
459
|
+
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
|
464
|
+
<div class="method-source-code" id="get-source">
|
465
|
+
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 115</span>
|
466
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get</span>(<span class="ruby-identifier">k</span>)
|
467
|
+
<span class="ruby-identifier">val</span> = <span class="ruby-ivar">@data</span> <span class="ruby-operator">?</span> <span class="ruby-ivar">@data</span>[<span class="ruby-identifier">k</span>] <span class="ruby-operator">:</span> <span class="ruby-identifier">store</span>.<span class="ruby-identifier">hget</span>(<span class="ruby-identifier">hkey</span>, <span class="ruby-identifier">k</span>.<span class="ruby-identifier">to_s</span>)
|
468
|
+
<span class="ruby-keyword">end</span></pre>
|
469
|
+
</div><!-- get-source -->
|
470
|
+
|
471
|
+
</div>
|
472
|
+
|
473
|
+
|
474
|
+
<div class="aliases">
|
475
|
+
Also aliased as: <a href="ObjectBase.html#method-i-5B-5D">[]</a>
|
476
|
+
</div>
|
477
|
+
|
478
|
+
|
479
|
+
|
480
|
+
</div><!-- get-method -->
|
481
|
+
|
482
|
+
|
483
|
+
<div id="method-i-id" class="method-detail ">
|
484
|
+
|
485
|
+
<div class="method-heading">
|
486
|
+
<span class="method-name">id</span><span
|
487
|
+
class="method-args">()</span>
|
488
|
+
<span class="method-click-advice">click to toggle source</span>
|
489
|
+
</div>
|
490
|
+
|
491
|
+
|
492
|
+
<div class="method-description">
|
493
|
+
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
|
498
|
+
<div class="method-source-code" id="id-source">
|
499
|
+
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 67</span>
|
500
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">id</span>
|
501
|
+
<span class="ruby-ivar">@id</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">set</span>(<span class="ruby-value">:id_sym</span>, <span class="ruby-identifier">get</span>(<span class="ruby-value">:id_sym</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">generate_id</span>)
|
502
|
+
<span class="ruby-keyword">end</span></pre>
|
503
|
+
</div><!-- id-source -->
|
504
|
+
|
505
|
+
</div>
|
506
|
+
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
</div><!-- id-method -->
|
511
|
+
|
512
|
+
|
513
|
+
<div id="method-i-inspect" class="method-detail method-alias">
|
514
|
+
|
515
|
+
<div class="method-heading">
|
516
|
+
<span class="method-name">inspect</span><span
|
517
|
+
class="method-args">()</span>
|
518
|
+
<span class="method-click-advice">click to toggle source</span>
|
519
|
+
</div>
|
520
|
+
|
521
|
+
|
522
|
+
<div class="method-description">
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
</div>
|
529
|
+
|
530
|
+
|
531
|
+
|
532
|
+
|
533
|
+
<div class="aliases">
|
534
|
+
Alias for: <a href="ObjectBase.html#method-i-raw">raw</a>
|
535
|
+
</div>
|
536
|
+
|
537
|
+
</div><!-- inspect-method -->
|
538
|
+
|
539
|
+
|
540
|
+
<div id="method-i-load" class="method-detail ">
|
541
|
+
|
542
|
+
<div class="method-heading">
|
543
|
+
<span class="method-name">load</span><span
|
544
|
+
class="method-args">(o_id)</span>
|
545
|
+
<span class="method-click-advice">click to toggle source</span>
|
546
|
+
</div>
|
547
|
+
|
548
|
+
|
549
|
+
<div class="method-description">
|
550
|
+
|
551
|
+
|
552
|
+
|
553
|
+
|
554
|
+
|
555
|
+
<div class="method-source-code" id="load-source">
|
556
|
+
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 71</span>
|
557
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">load</span>(<span class="ruby-identifier">o_id</span>)
|
558
|
+
<span class="ruby-ivar">@id</span> = <span class="ruby-identifier">o_id</span>
|
559
|
+
<span class="ruby-keyword">true</span>
|
560
|
+
<span class="ruby-keyword">end</span></pre>
|
561
|
+
</div><!-- load-source -->
|
562
|
+
|
563
|
+
</div>
|
564
|
+
|
565
|
+
|
566
|
+
|
567
|
+
|
568
|
+
</div><!-- load-method -->
|
569
|
+
|
570
|
+
|
571
|
+
<div id="method-i-new_id" class="method-detail ">
|
572
|
+
|
573
|
+
<div class="method-heading">
|
574
|
+
<span class="method-name">new_id</span><span
|
575
|
+
class="method-args">()</span>
|
576
|
+
<span class="method-click-advice">click to toggle source</span>
|
577
|
+
</div>
|
578
|
+
|
579
|
+
|
580
|
+
<div class="method-description">
|
581
|
+
|
582
|
+
|
583
|
+
|
584
|
+
|
585
|
+
|
586
|
+
<div class="method-source-code" id="new_id-source">
|
587
|
+
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 21</span>
|
588
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">new_id</span>
|
589
|
+
<span class="ruby-identifier">rand</span>(<span class="ruby-value">36</span><span class="ruby-operator">**</span><span class="ruby-value">8</span>).<span class="ruby-identifier">to_s</span>(<span class="ruby-value">36</span>)
|
590
|
+
<span class="ruby-keyword">end</span></pre>
|
591
|
+
</div><!-- new_id-source -->
|
592
|
+
|
593
|
+
</div>
|
594
|
+
|
595
|
+
|
596
|
+
|
597
|
+
|
598
|
+
</div><!-- new_id-method -->
|
599
|
+
|
600
|
+
|
601
|
+
<div id="method-i-parent" class="method-detail ">
|
602
|
+
|
603
|
+
<div class="method-heading">
|
604
|
+
<span class="method-name">parent</span><span
|
605
|
+
class="method-args">()</span>
|
606
|
+
<span class="method-click-advice">click to toggle source</span>
|
607
|
+
</div>
|
608
|
+
|
609
|
+
|
610
|
+
<div class="method-description">
|
611
|
+
|
612
|
+
|
613
|
+
|
614
|
+
|
615
|
+
|
616
|
+
<div class="method-source-code" id="parent-source">
|
617
|
+
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 55</span>
|
618
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">parent</span>
|
619
|
+
<span class="ruby-ivar">@parent</span> <span class="ruby-operator">||=</span> <span class="ruby-ivar">@parent_id</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">find_by_key</span>(<span class="ruby-ivar">@parent_id</span>) <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
|
620
|
+
<span class="ruby-keyword">end</span></pre>
|
621
|
+
</div><!-- parent-source -->
|
622
|
+
|
623
|
+
</div>
|
624
|
+
|
625
|
+
|
626
|
+
|
627
|
+
|
628
|
+
</div><!-- parent-method -->
|
629
|
+
|
630
|
+
|
631
|
+
<div id="method-i-parent-3D" class="method-detail ">
|
632
|
+
|
633
|
+
<div class="method-heading">
|
634
|
+
<span class="method-name">parent=</span><span
|
635
|
+
class="method-args">(obj)</span>
|
636
|
+
<span class="method-click-advice">click to toggle source</span>
|
637
|
+
</div>
|
638
|
+
|
639
|
+
|
640
|
+
<div class="method-description">
|
641
|
+
|
642
|
+
|
643
|
+
|
644
|
+
|
645
|
+
|
646
|
+
<div class="method-source-code" id="parent-3D-source">
|
647
|
+
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 59</span>
|
648
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">parent=</span>(<span class="ruby-identifier">obj</span>)
|
649
|
+
<span class="ruby-ivar">@parent</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">String</span> <span class="ruby-operator">?</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">find_by_key</span>(<span class="ruby-identifier">obj</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">obj</span>
|
650
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@parent</span>
|
651
|
+
<span class="ruby-ivar">@parent_id</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">hkey</span>
|
652
|
+
<span class="ruby-identifier">set</span>(<span class="ruby-value">:parent</span>, <span class="ruby-ivar">@parent_id</span>)
|
653
|
+
<span class="ruby-keyword">end</span>
|
654
|
+
<span class="ruby-keyword">end</span></pre>
|
655
|
+
</div><!-- parent-3D-source -->
|
656
|
+
|
657
|
+
</div>
|
658
|
+
|
659
|
+
|
660
|
+
|
661
|
+
|
662
|
+
</div><!-- parent-3D-method -->
|
663
|
+
|
664
|
+
|
665
|
+
<div id="method-i-raw" class="method-detail ">
|
666
|
+
|
667
|
+
<div class="method-heading">
|
668
|
+
<span class="method-name">raw</span><span
|
669
|
+
class="method-args">()</span>
|
670
|
+
<span class="method-click-advice">click to toggle source</span>
|
671
|
+
</div>
|
672
|
+
|
673
|
+
|
674
|
+
<div class="method-description">
|
675
|
+
|
676
|
+
|
677
|
+
|
678
|
+
|
679
|
+
|
680
|
+
<div class="method-source-code" id="raw-source">
|
681
|
+
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 105</span>
|
682
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">raw</span>
|
683
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@data</span>
|
684
|
+
<span class="ruby-ivar">@data</span>
|
685
|
+
<span class="ruby-keyword">else</span>
|
686
|
+
<span class="ruby-identifier">store</span>.<span class="ruby-identifier">hgetall</span>(<span class="ruby-identifier">hkey</span>).<span class="ruby-identifier">inject</span>({}) {<span class="ruby-operator">|</span><span class="ruby-identifier">acc</span>,<span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">acc</span>[<span class="ruby-identifier">k</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_sym</span>] = <span class="ruby-identifier">enforce_format</span>(<span class="ruby-identifier">k</span>[<span class="ruby-value">0</span>],<span class="ruby-identifier">k</span>[<span class="ruby-value">1</span>]); <span class="ruby-identifier">acc</span> }
|
687
|
+
<span class="ruby-keyword">end</span>
|
688
|
+
<span class="ruby-keyword">end</span></pre>
|
689
|
+
</div><!-- raw-source -->
|
690
|
+
|
691
|
+
</div>
|
692
|
+
|
693
|
+
|
694
|
+
<div class="aliases">
|
695
|
+
Also aliased as: <a href="ObjectBase.html#method-i-inspect">inspect</a>, <a href="ObjectBase.html#method-i-actual">actual</a>
|
696
|
+
</div>
|
697
|
+
|
698
|
+
|
699
|
+
|
700
|
+
</div><!-- raw-method -->
|
701
|
+
|
702
|
+
|
703
|
+
<div id="method-i-reserve" class="method-detail ">
|
704
|
+
|
705
|
+
<div class="method-heading">
|
706
|
+
<span class="method-name">reserve</span><span
|
707
|
+
class="method-args">(k)</span>
|
708
|
+
<span class="method-click-advice">click to toggle source</span>
|
709
|
+
</div>
|
710
|
+
|
711
|
+
|
712
|
+
<div class="method-description">
|
713
|
+
|
714
|
+
|
715
|
+
|
716
|
+
|
717
|
+
|
718
|
+
<div class="method-source-code" id="reserve-source">
|
719
|
+
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 36</span>
|
720
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">reserve</span>(<span class="ruby-identifier">k</span>)
|
721
|
+
<span class="ruby-identifier">store</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">reserve_key</span>(<span class="ruby-identifier">k</span>),<span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_s</span>)
|
722
|
+
<span class="ruby-keyword">end</span></pre>
|
723
|
+
</div><!-- reserve-source -->
|
724
|
+
|
725
|
+
</div>
|
726
|
+
|
727
|
+
|
728
|
+
|
729
|
+
|
730
|
+
</div><!-- reserve-method -->
|
731
|
+
|
732
|
+
|
733
|
+
<div id="method-i-save" class="method-detail ">
|
734
|
+
|
735
|
+
<div class="method-heading">
|
736
|
+
<span class="method-name">save</span><span
|
737
|
+
class="method-args">()</span>
|
738
|
+
<span class="method-click-advice">click to toggle source</span>
|
739
|
+
</div>
|
740
|
+
|
741
|
+
|
742
|
+
<div class="method-description">
|
743
|
+
|
744
|
+
|
745
|
+
|
746
|
+
|
747
|
+
|
748
|
+
<div class="method-source-code" id="save-source">
|
749
|
+
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 76</span>
|
750
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">save</span>
|
751
|
+
<span class="ruby-identifier">set</span>(<span class="ruby-value">:class</span>, <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>)
|
752
|
+
<span class="ruby-identifier">set</span>(<span class="ruby-identifier">id_sym</span>,<span class="ruby-identifier">id</span>)
|
753
|
+
<span class="ruby-identifier">set</span>(<span class="ruby-value">:key</span>, <span class="ruby-identifier">key</span>)
|
754
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@data</span>
|
755
|
+
<span class="ruby-identifier">saving</span> = <span class="ruby-ivar">@data</span>
|
756
|
+
<span class="ruby-ivar">@data</span> = <span class="ruby-keyword">false</span>
|
757
|
+
<span class="ruby-identifier">saving</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
758
|
+
<span class="ruby-identifier">set</span>(<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span>)
|
759
|
+
<span class="ruby-keyword">end</span>
|
760
|
+
<span class="ruby-keyword">end</span>
|
761
|
+
<span class="ruby-identifier">store</span>.<span class="ruby-identifier">sadd</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">cname</span>.<span class="ruby-identifier">pluralize</span>, <span class="ruby-identifier">key</span>)
|
762
|
+
<span class="ruby-identifier">store</span>.<span class="ruby-identifier">del</span>(<span class="ruby-identifier">reserve_key</span>)
|
763
|
+
<span class="ruby-keyword">end</span></pre>
|
764
|
+
</div><!-- save-source -->
|
765
|
+
|
766
|
+
</div>
|
767
|
+
|
768
|
+
|
769
|
+
|
770
|
+
|
771
|
+
</div><!-- save-method -->
|
772
|
+
|
773
|
+
|
774
|
+
<div id="method-i-set" class="method-detail ">
|
775
|
+
|
776
|
+
<div class="method-heading">
|
777
|
+
<span class="method-name">set</span><span
|
778
|
+
class="method-args">(k,v)</span>
|
779
|
+
<span class="method-click-advice">click to toggle source</span>
|
780
|
+
</div>
|
781
|
+
|
782
|
+
|
783
|
+
<div class="method-description">
|
784
|
+
|
785
|
+
|
786
|
+
|
787
|
+
|
788
|
+
|
789
|
+
<div class="method-source-code" id="set-source">
|
790
|
+
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 120</span>
|
791
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">set</span>(<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span>)
|
792
|
+
<span class="ruby-ivar">@data</span> <span class="ruby-operator">?</span> <span class="ruby-ivar">@data</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">store</span>.<span class="ruby-identifier">hset</span>(<span class="ruby-identifier">hkey</span>, <span class="ruby-identifier">k</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">%r\=$/</span>,<span class="ruby-string">''</span>), <span class="ruby-identifier">v</span>)
|
793
|
+
<span class="ruby-identifier">v</span>
|
794
|
+
<span class="ruby-keyword">end</span></pre>
|
795
|
+
</div><!-- set-source -->
|
796
|
+
|
797
|
+
</div>
|
798
|
+
|
799
|
+
|
800
|
+
<div class="aliases">
|
801
|
+
Also aliased as: <a href="ObjectBase.html#method-i-5B-5D-3D">[]=</a>
|
802
|
+
</div>
|
803
|
+
|
804
|
+
|
805
|
+
|
806
|
+
</div><!-- set-method -->
|
807
|
+
|
808
|
+
|
809
|
+
<div id="method-i-to_json" class="method-detail ">
|
810
|
+
|
811
|
+
<div class="method-heading">
|
812
|
+
<span class="method-name">to_json</span><span
|
813
|
+
class="method-args">()</span>
|
814
|
+
<span class="method-click-advice">click to toggle source</span>
|
815
|
+
</div>
|
816
|
+
|
817
|
+
|
818
|
+
<div class="method-description">
|
819
|
+
|
820
|
+
|
821
|
+
|
822
|
+
|
823
|
+
|
824
|
+
<div class="method-source-code" id="to_json-source">
|
825
|
+
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 40</span>
|
826
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_json</span>
|
827
|
+
<span class="ruby-identifier">require</span> <span class="ruby-string">'yajl'</span>
|
828
|
+
<span class="ruby-constant">Yajl</span><span class="ruby-operator">::</span><span class="ruby-constant">Encoder</span>.<span class="ruby-identifier">encode</span>(<span class="ruby-identifier">actual</span>)
|
829
|
+
<span class="ruby-keyword">end</span></pre>
|
830
|
+
</div><!-- to_json-source -->
|
831
|
+
|
832
|
+
</div>
|
833
|
+
|
834
|
+
|
835
|
+
|
836
|
+
|
837
|
+
</div><!-- to_json-method -->
|
838
|
+
|
839
|
+
|
840
|
+
</section><!-- public-instance-method-details -->
|
841
|
+
|
842
|
+
</section><!-- 5Buntitled-5D -->
|
843
|
+
|
844
|
+
</div><!-- documentation -->
|
845
|
+
|
846
|
+
|
847
|
+
<footer id="validator-badges">
|
848
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
849
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
850
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
851
|
+
</footer>
|
852
|
+
|