redis_object 1.0 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.coveralls.yml +1 -0
- data/.gitignore +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/README.markdown +24 -15
- data/Rakefile +8 -0
- data/lib/redis_object.rb +11 -1
- data/lib/redis_object/base.rb +210 -60
- data/lib/redis_object/collection.rb +130 -100
- data/lib/redis_object/defaults.rb +21 -8
- data/lib/redis_object/{history.rb → experimental/history.rb} +0 -0
- data/lib/redis_object/ext/filters.rb +34 -16
- data/lib/redis_object/ext/script_cache.rb +92 -0
- data/lib/redis_object/ext/shardable.rb +18 -0
- data/lib/redis_object/ext/triggers.rb +75 -13
- data/lib/redis_object/ext/view_caching.rb +258 -0
- data/lib/redis_object/ext/views.rb +102 -0
- data/lib/redis_object/indices.rb +44 -39
- data/lib/redis_object/inheritance_tracking.rb +23 -0
- data/lib/redis_object/keys.rb +4 -4
- data/lib/redis_object/storage.rb +30 -1
- data/lib/redis_object/storage/adapter.rb +6 -3
- data/lib/redis_object/storage/redis.rb +98 -3
- data/lib/redis_object/timestamps.rb +42 -21
- data/lib/redis_object/types.rb +172 -30
- data/lib/redis_object/version.rb +1 -1
- data/redis_object.gemspec +1 -0
- data/spec/adapter_spec.rb +43 -0
- data/spec/base_spec.rb +41 -6
- data/spec/benchmark_spec.rb +46 -0
- data/spec/collections_spec.rb +144 -0
- data/spec/defaults_spec.rb +56 -0
- data/spec/filters_spec.rb +29 -0
- data/spec/indices_spec.rb +45 -0
- data/spec/rename_class_spec.rb +96 -0
- data/spec/spec_helper.rb +32 -1
- data/spec/timestamp_spec.rb +28 -0
- data/spec/trigger_spec.rb +51 -0
- data/spec/types_spec.rb +103 -0
- data/spec/view_caching_spec.rb +130 -0
- data/spec/views_spec.rb +72 -0
- metadata +111 -116
- data/doc/Object.html +0 -185
- data/doc/Seabright.html +0 -181
- data/doc/Seabright/Adapter.html +0 -442
- data/doc/Seabright/Collection.html +0 -797
- data/doc/Seabright/Collections.html +0 -635
- data/doc/Seabright/Collections/ClassMethods.html +0 -212
- data/doc/Seabright/ExternalIndex.html +0 -217
- data/doc/Seabright/History.html +0 -382
- data/doc/Seabright/History/ClassMethods.html +0 -276
- data/doc/Seabright/Indices.html +0 -324
- data/doc/Seabright/Indices/ClassMethods.html +0 -348
- data/doc/Seabright/Keys.html +0 -314
- data/doc/Seabright/Keys/ClassMethods.html +0 -276
- data/doc/Seabright/ObjectBase.html +0 -852
- data/doc/Seabright/ObjectBase/ClassMethods.html +0 -677
- data/doc/Seabright/RedisObject.html +0 -230
- data/doc/Seabright/References.html +0 -280
- data/doc/Seabright/Storage.html +0 -252
- data/doc/Seabright/Storage/ClassMethods.html +0 -276
- data/doc/Seabright/Storage/MySQL.html +0 -442
- data/doc/Seabright/Storage/Redis.html +0 -218
- data/doc/Seabright/Template.html +0 -212
- data/doc/Seabright/Template/ClassMethods.html +0 -166
- data/doc/Seabright/Timestamps.html +0 -292
- data/doc/Seabright/Timestamps/ClassMethods.html +0 -214
- data/doc/Seabright/Types.html +0 -410
- data/doc/Seabright/Types/ClassMethods.html +0 -308
- data/doc/created.rid +0 -17
- 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 +0 -125
- data/doc/js/darkfish.js +0 -153
- data/doc/js/jquery.js +0 -18
- data/doc/js/navigation.js +0 -142
- data/doc/js/search.js +0 -94
- data/doc/js/search_index.js +0 -1
- data/doc/js/searcher.js +0 -228
- data/doc/rdoc.css +0 -543
- data/doc/table_of_contents.html +0 -394
@@ -1,677 +0,0 @@
|
|
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::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/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-i-all">#all</a>
|
68
|
-
|
69
|
-
<li><a href="#method-i-cname">#cname</a>
|
70
|
-
|
71
|
-
<li><a href="#method-i-create">#create</a>
|
72
|
-
|
73
|
-
<li><a href="#method-i-dbnum">#dbnum</a>
|
74
|
-
|
75
|
-
<li><a href="#method-i-deep_const_get">#deep_const_get</a>
|
76
|
-
|
77
|
-
<li><a href="#method-i-dump">#dump</a>
|
78
|
-
|
79
|
-
<li><a href="#method-i-each">#each</a>
|
80
|
-
|
81
|
-
<li><a href="#method-i-exists-3F">#exists?</a>
|
82
|
-
|
83
|
-
<li><a href="#method-i-find">#find</a>
|
84
|
-
|
85
|
-
<li><a href="#method-i-find_by_key">#find_by_key</a>
|
86
|
-
|
87
|
-
<li><a href="#method-i-id_sym">#id_sym</a>
|
88
|
-
|
89
|
-
<li><a href="#method-i-plname">#plname</a>
|
90
|
-
|
91
|
-
<li><a href="#method-i-save_all">#save_all</a>
|
92
|
-
|
93
|
-
<li><a href="#method-i-use_dbnum">#use_dbnum</a>
|
94
|
-
|
95
|
-
</ul>
|
96
|
-
</nav>
|
97
|
-
|
98
|
-
</div>
|
99
|
-
|
100
|
-
<div id="project-metadata">
|
101
|
-
|
102
|
-
<nav id="classindex-section" class="section project-section">
|
103
|
-
<h3 class="section-header">Class and Module Index</h3>
|
104
|
-
|
105
|
-
<ul class="link-list">
|
106
|
-
|
107
|
-
<li><a href="../../Seabright.html">Seabright</a>
|
108
|
-
|
109
|
-
<li><a href="../../Seabright/Adapter.html">Seabright::Adapter</a>
|
110
|
-
|
111
|
-
<li><a href="../../Seabright/Collection.html">Seabright::Collection</a>
|
112
|
-
|
113
|
-
<li><a href="../../Seabright/Collections.html">Seabright::Collections</a>
|
114
|
-
|
115
|
-
<li><a href="../../Seabright/Collections/ClassMethods.html">Seabright::Collections::ClassMethods</a>
|
116
|
-
|
117
|
-
<li><a href="../../Seabright/ExternalIndex.html">Seabright::ExternalIndex</a>
|
118
|
-
|
119
|
-
<li><a href="../../Seabright/History.html">Seabright::History</a>
|
120
|
-
|
121
|
-
<li><a href="../../Seabright/History/ClassMethods.html">Seabright::History::ClassMethods</a>
|
122
|
-
|
123
|
-
<li><a href="../../Seabright/Indices.html">Seabright::Indices</a>
|
124
|
-
|
125
|
-
<li><a href="../../Seabright/Indices/ClassMethods.html">Seabright::Indices::ClassMethods</a>
|
126
|
-
|
127
|
-
<li><a href="../../Seabright/Keys.html">Seabright::Keys</a>
|
128
|
-
|
129
|
-
<li><a href="../../Seabright/Keys/ClassMethods.html">Seabright::Keys::ClassMethods</a>
|
130
|
-
|
131
|
-
<li><a href="../../Seabright/ObjectBase.html">Seabright::ObjectBase</a>
|
132
|
-
|
133
|
-
<li><a href="../../Seabright/ObjectBase/ClassMethods.html">Seabright::ObjectBase::ClassMethods</a>
|
134
|
-
|
135
|
-
<li><a href="../../Seabright/RedisObject.html">Seabright::RedisObject</a>
|
136
|
-
|
137
|
-
<li><a href="../../Seabright/RedisObject.html">Seabright::RedisObject</a>
|
138
|
-
|
139
|
-
<li><a href="../../Seabright/References.html">Seabright::References</a>
|
140
|
-
|
141
|
-
<li><a href="../../Seabright/Storage.html">Seabright::Storage</a>
|
142
|
-
|
143
|
-
<li><a href="../../Seabright/Storage/ClassMethods.html">Seabright::Storage::ClassMethods</a>
|
144
|
-
|
145
|
-
<li><a href="../../Seabright/Storage/MySQL.html">Seabright::Storage::MySQL</a>
|
146
|
-
|
147
|
-
<li><a href="../../Seabright/Storage/Redis.html">Seabright::Storage::Redis</a>
|
148
|
-
|
149
|
-
<li><a href="../../Seabright/Template.html">Seabright::Template</a>
|
150
|
-
|
151
|
-
<li><a href="../../Seabright/Template/ClassMethods.html">Seabright::Template::ClassMethods</a>
|
152
|
-
|
153
|
-
<li><a href="../../Seabright/Timestamps.html">Seabright::Timestamps</a>
|
154
|
-
|
155
|
-
<li><a href="../../Seabright/Timestamps/ClassMethods.html">Seabright::Timestamps::ClassMethods</a>
|
156
|
-
|
157
|
-
<li><a href="../../Seabright/Types.html">Seabright::Types</a>
|
158
|
-
|
159
|
-
<li><a href="../../Seabright/Types/ClassMethods.html">Seabright::Types::ClassMethods</a>
|
160
|
-
|
161
|
-
<li><a href="../../Object.html">Object</a>
|
162
|
-
|
163
|
-
<li><a href="../../Seabright/RedisObject.html">Object::RedisObject</a>
|
164
|
-
|
165
|
-
</ul>
|
166
|
-
</nav>
|
167
|
-
|
168
|
-
</div>
|
169
|
-
</nav>
|
170
|
-
|
171
|
-
<div id="documentation">
|
172
|
-
<h1 class="module">module Seabright::ObjectBase::ClassMethods</h1>
|
173
|
-
|
174
|
-
<div id="description" class="description">
|
175
|
-
|
176
|
-
</div><!-- description -->
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
<!-- Methods -->
|
191
|
-
|
192
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
|
193
|
-
<h3 class="section-header">Public Instance Methods</h3>
|
194
|
-
|
195
|
-
|
196
|
-
<div id="method-i-all" class="method-detail ">
|
197
|
-
|
198
|
-
<div class="method-heading">
|
199
|
-
<span class="method-name">all</span><span
|
200
|
-
class="method-args">()</span>
|
201
|
-
<span class="method-click-advice">click to toggle source</span>
|
202
|
-
</div>
|
203
|
-
|
204
|
-
|
205
|
-
<div class="method-description">
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
<div class="method-source-code" id="all-source">
|
212
|
-
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 146</span>
|
213
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">all</span>
|
214
|
-
<span class="ruby-identifier">out</span> = []
|
215
|
-
<span class="ruby-identifier">store</span>.<span class="ruby-identifier">smembers</span>(<span class="ruby-identifier">plname</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">member</span><span class="ruby-operator">|</span>
|
216
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">a</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">member</span>)
|
217
|
-
<span class="ruby-identifier">out</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">a</span>
|
218
|
-
<span class="ruby-keyword">else</span>
|
219
|
-
<span class="ruby-comment"># store.srem(plname,member)</span>
|
220
|
-
<span class="ruby-keyword">end</span>
|
221
|
-
<span class="ruby-keyword">end</span>
|
222
|
-
<span class="ruby-identifier">out</span>
|
223
|
-
<span class="ruby-keyword">end</span></pre>
|
224
|
-
</div><!-- all-source -->
|
225
|
-
|
226
|
-
</div>
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
</div><!-- all-method -->
|
232
|
-
|
233
|
-
|
234
|
-
<div id="method-i-cname" class="method-detail ">
|
235
|
-
|
236
|
-
<div class="method-heading">
|
237
|
-
<span class="method-name">cname</span><span
|
238
|
-
class="method-args">()</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="cname-source">
|
250
|
-
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 138</span>
|
251
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">cname</span>
|
252
|
-
<span class="ruby-ivar">@cname</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">'::'</span>).<span class="ruby-identifier">last</span>
|
253
|
-
<span class="ruby-keyword">end</span></pre>
|
254
|
-
</div><!-- cname-source -->
|
255
|
-
|
256
|
-
</div>
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
</div><!-- cname-method -->
|
262
|
-
|
263
|
-
|
264
|
-
<div id="method-i-create" class="method-detail ">
|
265
|
-
|
266
|
-
<div class="method-heading">
|
267
|
-
<span class="method-name">create</span><span
|
268
|
-
class="method-args">(ident)</span>
|
269
|
-
<span class="method-click-advice">click to toggle source</span>
|
270
|
-
</div>
|
271
|
-
|
272
|
-
|
273
|
-
<div class="method-description">
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
<div class="method-source-code" id="create-source">
|
280
|
-
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 185</span>
|
281
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create</span>(<span class="ruby-identifier">ident</span>)
|
282
|
-
<span class="ruby-identifier">obj</span> = <span class="ruby-identifier">new</span>(<span class="ruby-identifier">ident</span>)
|
283
|
-
<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">save</span>
|
284
|
-
<span class="ruby-identifier">obj</span>
|
285
|
-
<span class="ruby-keyword">end</span></pre>
|
286
|
-
</div><!-- create-source -->
|
287
|
-
|
288
|
-
</div>
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
</div><!-- create-method -->
|
294
|
-
|
295
|
-
|
296
|
-
<div id="method-i-dbnum" class="method-detail ">
|
297
|
-
|
298
|
-
<div class="method-heading">
|
299
|
-
<span class="method-name">dbnum</span><span
|
300
|
-
class="method-args">()</span>
|
301
|
-
<span class="method-click-advice">click to toggle source</span>
|
302
|
-
</div>
|
303
|
-
|
304
|
-
|
305
|
-
<div class="method-description">
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
<div class="method-source-code" id="dbnum-source">
|
312
|
-
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 203</span>
|
313
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">dbnum</span>
|
314
|
-
<span class="ruby-ivar">@dbnum</span> <span class="ruby-operator">||=</span> <span class="ruby-value">0</span>
|
315
|
-
<span class="ruby-keyword">end</span></pre>
|
316
|
-
</div><!-- dbnum-source -->
|
317
|
-
|
318
|
-
</div>
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
</div><!-- dbnum-method -->
|
324
|
-
|
325
|
-
|
326
|
-
<div id="method-i-deep_const_get" class="method-detail ">
|
327
|
-
|
328
|
-
<div class="method-heading">
|
329
|
-
<span class="method-name">deep_const_get</span><span
|
330
|
-
class="method-args">(const)</span>
|
331
|
-
<span class="method-click-advice">click to toggle source</span>
|
332
|
-
</div>
|
333
|
-
|
334
|
-
|
335
|
-
<div class="method-description">
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
<div class="method-source-code" id="deep_const_get-source">
|
342
|
-
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 218</span>
|
343
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">deep_const_get</span>(<span class="ruby-identifier">const</span>)
|
344
|
-
<span class="ruby-keyword">if</span> <span class="ruby-constant">Symbol</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">const</span>
|
345
|
-
<span class="ruby-identifier">const</span> = <span class="ruby-identifier">const</span>.<span class="ruby-identifier">to_s</span>
|
346
|
-
<span class="ruby-keyword">else</span>
|
347
|
-
<span class="ruby-identifier">const</span> = <span class="ruby-identifier">const</span>.<span class="ruby-identifier">to_str</span>.<span class="ruby-identifier">dup</span>
|
348
|
-
<span class="ruby-keyword">end</span>
|
349
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">const</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp">%r^::/</span>, <span class="ruby-string">''</span>)
|
350
|
-
<span class="ruby-identifier">base</span> = <span class="ruby-constant">Object</span>
|
351
|
-
<span class="ruby-keyword">else</span>
|
352
|
-
<span class="ruby-identifier">base</span> = <span class="ruby-keyword">self</span>
|
353
|
-
<span class="ruby-keyword">end</span>
|
354
|
-
<span class="ruby-identifier">const</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">%r::/</span>).<span class="ruby-identifier">inject</span>(<span class="ruby-identifier">base</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">mod</span>, <span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">name</span>) }
|
355
|
-
<span class="ruby-keyword">end</span></pre>
|
356
|
-
</div><!-- deep_const_get-source -->
|
357
|
-
|
358
|
-
</div>
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
</div><!-- deep_const_get-method -->
|
364
|
-
|
365
|
-
|
366
|
-
<div id="method-i-dump" class="method-detail ">
|
367
|
-
|
368
|
-
<div class="method-heading">
|
369
|
-
<span class="method-name">dump</span><span
|
370
|
-
class="method-args">()</span>
|
371
|
-
<span class="method-click-advice">click to toggle source</span>
|
372
|
-
</div>
|
373
|
-
|
374
|
-
|
375
|
-
<div class="method-description">
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
<div class="method-source-code" id="dump-source">
|
382
|
-
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 191</span>
|
383
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">dump</span>
|
384
|
-
<span class="ruby-identifier">out</span> = []
|
385
|
-
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">all</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">obj</span><span class="ruby-operator">|</span>
|
386
|
-
<span class="ruby-identifier">out</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">dump</span>
|
387
|
-
<span class="ruby-keyword">end</span>
|
388
|
-
<span class="ruby-identifier">out</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">"\n"</span>)
|
389
|
-
<span class="ruby-keyword">end</span></pre>
|
390
|
-
</div><!-- dump-source -->
|
391
|
-
|
392
|
-
</div>
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
</div><!-- dump-method -->
|
398
|
-
|
399
|
-
|
400
|
-
<div id="method-i-each" class="method-detail ">
|
401
|
-
|
402
|
-
<div class="method-heading">
|
403
|
-
<span class="method-name">each</span><span
|
404
|
-
class="method-args">() { |a| ... }</span>
|
405
|
-
<span class="method-click-advice">click to toggle source</span>
|
406
|
-
</div>
|
407
|
-
|
408
|
-
|
409
|
-
<div class="method-description">
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
<div class="method-source-code" id="each-source">
|
416
|
-
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 158</span>
|
417
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">each</span>
|
418
|
-
<span class="ruby-identifier">store</span>.<span class="ruby-identifier">smembers</span>(<span class="ruby-identifier">plname</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">member</span><span class="ruby-operator">|</span>
|
419
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">a</span> = <span class="ruby-identifier">find</span>(<span class="ruby-identifier">member</span>)
|
420
|
-
<span class="ruby-keyword">yield</span> <span class="ruby-identifier">a</span>
|
421
|
-
<span class="ruby-keyword">end</span>
|
422
|
-
<span class="ruby-keyword">end</span>
|
423
|
-
<span class="ruby-keyword">end</span></pre>
|
424
|
-
</div><!-- each-source -->
|
425
|
-
|
426
|
-
</div>
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
</div><!-- each-method -->
|
432
|
-
|
433
|
-
|
434
|
-
<div id="method-i-exists-3F" class="method-detail ">
|
435
|
-
|
436
|
-
<div class="method-heading">
|
437
|
-
<span class="method-name">exists?</span><span
|
438
|
-
class="method-args">(k)</span>
|
439
|
-
<span class="method-click-advice">click to toggle source</span>
|
440
|
-
</div>
|
441
|
-
|
442
|
-
|
443
|
-
<div class="method-description">
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
<div class="method-source-code" id="exists-3F-source">
|
450
|
-
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 181</span>
|
451
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">k</span>)
|
452
|
-
<span class="ruby-identifier">store</span>.<span class="ruby-identifier">exists</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">hkey</span>(<span class="ruby-identifier">k</span>)) <span class="ruby-operator">||</span> <span class="ruby-identifier">store</span>.<span class="ruby-identifier">exists</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">reserve_key</span>(<span class="ruby-identifier">k</span>))
|
453
|
-
<span class="ruby-keyword">end</span></pre>
|
454
|
-
</div><!-- exists-3F-source -->
|
455
|
-
|
456
|
-
</div>
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
</div><!-- exists-3F-method -->
|
462
|
-
|
463
|
-
|
464
|
-
<div id="method-i-find" class="method-detail ">
|
465
|
-
|
466
|
-
<div class="method-heading">
|
467
|
-
<span class="method-name">find</span><span
|
468
|
-
class="method-args">(ident,prnt=nil)</span>
|
469
|
-
<span class="method-click-advice">click to toggle source</span>
|
470
|
-
</div>
|
471
|
-
|
472
|
-
|
473
|
-
<div class="method-description">
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
<div class="method-source-code" id="find-source">
|
480
|
-
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 166</span>
|
481
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">find</span>(<span class="ruby-identifier">ident</span>,<span class="ruby-identifier">prnt</span>=<span class="ruby-keyword">nil</span>)
|
482
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">ident</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">String</span>
|
483
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">store</span>.<span class="ruby-identifier">exists</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">hkey</span>(<span class="ruby-identifier">ident</span>,<span class="ruby-identifier">prnt</span>)) <span class="ruby-operator">?</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ident</span>,<span class="ruby-identifier">prnt</span>) <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
|
484
|
-
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">ident</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Hash</span>
|
485
|
-
<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">obj</span><span class="ruby-operator">|</span>
|
486
|
-
<span class="ruby-identifier">good</span> = <span class="ruby-keyword">true</span>
|
487
|
-
<span class="ruby-identifier">ident</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>
|
488
|
-
<span class="ruby-identifier">good</span> = <span class="ruby-keyword">false</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">obj</span>[<span class="ruby-identifier">k</span>.<span class="ruby-identifier">to_sym</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">obj</span>[<span class="ruby-identifier">k</span>.<span class="ruby-identifier">to_sym</span>]<span class="ruby-operator">!=</span><span class="ruby-identifier">v</span>
|
489
|
-
<span class="ruby-keyword">end</span>
|
490
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">obj</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">good</span>
|
491
|
-
<span class="ruby-keyword">end</span>
|
492
|
-
<span class="ruby-keyword">end</span>
|
493
|
-
<span class="ruby-keyword">nil</span>
|
494
|
-
<span class="ruby-keyword">end</span></pre>
|
495
|
-
</div><!-- find-source -->
|
496
|
-
|
497
|
-
</div>
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
</div><!-- find-method -->
|
503
|
-
|
504
|
-
|
505
|
-
<div id="method-i-find_by_key" class="method-detail ">
|
506
|
-
|
507
|
-
<div class="method-heading">
|
508
|
-
<span class="method-name">find_by_key</span><span
|
509
|
-
class="method-args">(k)</span>
|
510
|
-
<span class="method-click-advice">click to toggle source</span>
|
511
|
-
</div>
|
512
|
-
|
513
|
-
|
514
|
-
<div class="method-description">
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
<div class="method-source-code" id="find_by_key-source">
|
521
|
-
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 207</span>
|
522
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">find_by_key</span>(<span class="ruby-identifier">k</span>)
|
523
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">cls</span> = <span class="ruby-identifier">store</span>.<span class="ruby-identifier">hget</span>(<span class="ruby-identifier">k</span>,<span class="ruby-value">:class</span>)
|
524
|
-
<span class="ruby-identifier">o_id</span> = <span class="ruby-identifier">store</span>.<span class="ruby-identifier">hget</span>(<span class="ruby-identifier">k</span>,<span class="ruby-identifier">id_sym</span>(<span class="ruby-identifier">cls</span>))
|
525
|
-
<span class="ruby-identifier">prnt</span> = <span class="ruby-identifier">store</span>.<span class="ruby-identifier">hget</span>(<span class="ruby-identifier">k</span>,<span class="ruby-value">:parent</span>)
|
526
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">store</span>.<span class="ruby-identifier">exists</span>(<span class="ruby-identifier">k</span>)
|
527
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">deep_const_get</span>(<span class="ruby-identifier">cls</span>.<span class="ruby-identifier">to_sym</span>).<span class="ruby-identifier">new</span>(<span class="ruby-identifier">o_id</span>,<span class="ruby-identifier">prnt</span>)
|
528
|
-
<span class="ruby-keyword">end</span>
|
529
|
-
<span class="ruby-keyword">end</span>
|
530
|
-
<span class="ruby-keyword">nil</span>
|
531
|
-
<span class="ruby-keyword">end</span></pre>
|
532
|
-
</div><!-- find_by_key-source -->
|
533
|
-
|
534
|
-
</div>
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
</div><!-- find_by_key-method -->
|
540
|
-
|
541
|
-
|
542
|
-
<div id="method-i-id_sym" class="method-detail ">
|
543
|
-
|
544
|
-
<div class="method-heading">
|
545
|
-
<span class="method-name">id_sym</span><span
|
546
|
-
class="method-args">(cls=nil)</span>
|
547
|
-
<span class="method-click-advice">click to toggle source</span>
|
548
|
-
</div>
|
549
|
-
|
550
|
-
|
551
|
-
<div class="method-description">
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
<div class="method-source-code" id="id_sym-source">
|
558
|
-
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 239</span>
|
559
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">id_sym</span>(<span class="ruby-identifier">cls</span>=<span class="ruby-keyword">nil</span>)
|
560
|
-
<span class="ruby-node">"#{(cls || cname).downcase}_id"</span>.<span class="ruby-identifier">to_sym</span>
|
561
|
-
<span class="ruby-keyword">end</span></pre>
|
562
|
-
</div><!-- id_sym-source -->
|
563
|
-
|
564
|
-
</div>
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
</div><!-- id_sym-method -->
|
570
|
-
|
571
|
-
|
572
|
-
<div id="method-i-plname" class="method-detail ">
|
573
|
-
|
574
|
-
<div class="method-heading">
|
575
|
-
<span class="method-name">plname</span><span
|
576
|
-
class="method-args">()</span>
|
577
|
-
<span class="method-click-advice">click to toggle source</span>
|
578
|
-
</div>
|
579
|
-
|
580
|
-
|
581
|
-
<div class="method-description">
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
<div class="method-source-code" id="plname-source">
|
588
|
-
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 142</span>
|
589
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">plname</span>
|
590
|
-
<span class="ruby-ivar">@plname</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">cname</span>.<span class="ruby-identifier">pluralize</span>
|
591
|
-
<span class="ruby-keyword">end</span></pre>
|
592
|
-
</div><!-- plname-source -->
|
593
|
-
|
594
|
-
</div>
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
</div><!-- plname-method -->
|
600
|
-
|
601
|
-
|
602
|
-
<div id="method-i-save_all" class="method-detail ">
|
603
|
-
|
604
|
-
<div class="method-heading">
|
605
|
-
<span class="method-name">save_all</span><span
|
606
|
-
class="method-args">()</span>
|
607
|
-
<span class="method-click-advice">click to toggle source</span>
|
608
|
-
</div>
|
609
|
-
|
610
|
-
|
611
|
-
<div class="method-description">
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
<div class="method-source-code" id="save_all-source">
|
618
|
-
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 232</span>
|
619
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">save_all</span>
|
620
|
-
<span class="ruby-identifier">all</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">obj</span><span class="ruby-operator">|</span>
|
621
|
-
<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">save</span>
|
622
|
-
<span class="ruby-keyword">end</span>
|
623
|
-
<span class="ruby-keyword">true</span>
|
624
|
-
<span class="ruby-keyword">end</span></pre>
|
625
|
-
</div><!-- save_all-source -->
|
626
|
-
|
627
|
-
</div>
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
</div><!-- save_all-method -->
|
633
|
-
|
634
|
-
|
635
|
-
<div id="method-i-use_dbnum" class="method-detail ">
|
636
|
-
|
637
|
-
<div class="method-heading">
|
638
|
-
<span class="method-name">use_dbnum</span><span
|
639
|
-
class="method-args">(db=0)</span>
|
640
|
-
<span class="method-click-advice">click to toggle source</span>
|
641
|
-
</div>
|
642
|
-
|
643
|
-
|
644
|
-
<div class="method-description">
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
<div class="method-source-code" id="use_dbnum-source">
|
651
|
-
<pre><span class="ruby-comment"># File lib/redis_object/base.rb, line 199</span>
|
652
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">use_dbnum</span>(<span class="ruby-identifier">db</span>=<span class="ruby-value">0</span>)
|
653
|
-
<span class="ruby-ivar">@dbnum</span> = <span class="ruby-identifier">db</span>
|
654
|
-
<span class="ruby-keyword">end</span></pre>
|
655
|
-
</div><!-- use_dbnum-source -->
|
656
|
-
|
657
|
-
</div>
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
</div><!-- use_dbnum-method -->
|
663
|
-
|
664
|
-
|
665
|
-
</section><!-- public-instance-method-details -->
|
666
|
-
|
667
|
-
</section><!-- 5Buntitled-5D -->
|
668
|
-
|
669
|
-
</div><!-- documentation -->
|
670
|
-
|
671
|
-
|
672
|
-
<footer id="validator-badges">
|
673
|
-
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
674
|
-
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
675
|
-
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
676
|
-
</footer>
|
677
|
-
|