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,394 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>Table of Contents - 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 class="indexpage">
|
24
|
+
<h1>Table of Contents - StubbornObject</h1>
|
25
|
+
|
26
|
+
|
27
|
+
<h2 id="classes">Classes/Modules</h2>
|
28
|
+
<ul>
|
29
|
+
<li class="module">
|
30
|
+
<a href="Seabright.html">Seabright</a>
|
31
|
+
</li>
|
32
|
+
<li class="class">
|
33
|
+
<a href="Seabright/Adapter.html">Seabright::Adapter</a>
|
34
|
+
</li>
|
35
|
+
<li class="class">
|
36
|
+
<a href="Seabright/Collection.html">Seabright::Collection</a>
|
37
|
+
</li>
|
38
|
+
<li class="module">
|
39
|
+
<a href="Seabright/Collections.html">Seabright::Collections</a>
|
40
|
+
</li>
|
41
|
+
<li class="module">
|
42
|
+
<a href="Seabright/Collections/ClassMethods.html">Seabright::Collections::ClassMethods</a>
|
43
|
+
</li>
|
44
|
+
<li class="class">
|
45
|
+
<a href="Seabright/ExternalIndex.html">Seabright::ExternalIndex</a>
|
46
|
+
</li>
|
47
|
+
<li class="module">
|
48
|
+
<a href="Seabright/History.html">Seabright::History</a>
|
49
|
+
</li>
|
50
|
+
<li class="module">
|
51
|
+
<a href="Seabright/History/ClassMethods.html">Seabright::History::ClassMethods</a>
|
52
|
+
</li>
|
53
|
+
<li class="module">
|
54
|
+
<a href="Seabright/Indices.html">Seabright::Indices</a>
|
55
|
+
</li>
|
56
|
+
<li class="module">
|
57
|
+
<a href="Seabright/Indices/ClassMethods.html">Seabright::Indices::ClassMethods</a>
|
58
|
+
</li>
|
59
|
+
<li class="module">
|
60
|
+
<a href="Seabright/Keys.html">Seabright::Keys</a>
|
61
|
+
</li>
|
62
|
+
<li class="module">
|
63
|
+
<a href="Seabright/Keys/ClassMethods.html">Seabright::Keys::ClassMethods</a>
|
64
|
+
</li>
|
65
|
+
<li class="module">
|
66
|
+
<a href="Seabright/ObjectBase.html">Seabright::ObjectBase</a>
|
67
|
+
</li>
|
68
|
+
<li class="module">
|
69
|
+
<a href="Seabright/ObjectBase/ClassMethods.html">Seabright::ObjectBase::ClassMethods</a>
|
70
|
+
</li>
|
71
|
+
<li class="class">
|
72
|
+
<a href="Seabright/RedisObject.html">Seabright::RedisObject</a>
|
73
|
+
</li>
|
74
|
+
<li class="class">
|
75
|
+
<a href="Seabright/RedisObject.html">Seabright::RedisObject</a>
|
76
|
+
</li>
|
77
|
+
<li class="module">
|
78
|
+
<a href="Seabright/References.html">Seabright::References</a>
|
79
|
+
</li>
|
80
|
+
<li class="module">
|
81
|
+
<a href="Seabright/Storage.html">Seabright::Storage</a>
|
82
|
+
</li>
|
83
|
+
<li class="module">
|
84
|
+
<a href="Seabright/Storage/ClassMethods.html">Seabright::Storage::ClassMethods</a>
|
85
|
+
</li>
|
86
|
+
<li class="class">
|
87
|
+
<a href="Seabright/Storage/MySQL.html">Seabright::Storage::MySQL</a>
|
88
|
+
</li>
|
89
|
+
<li class="class">
|
90
|
+
<a href="Seabright/Storage/Redis.html">Seabright::Storage::Redis</a>
|
91
|
+
</li>
|
92
|
+
<li class="module">
|
93
|
+
<a href="Seabright/Template.html">Seabright::Template</a>
|
94
|
+
</li>
|
95
|
+
<li class="module">
|
96
|
+
<a href="Seabright/Template/ClassMethods.html">Seabright::Template::ClassMethods</a>
|
97
|
+
</li>
|
98
|
+
<li class="module">
|
99
|
+
<a href="Seabright/Timestamps.html">Seabright::Timestamps</a>
|
100
|
+
</li>
|
101
|
+
<li class="module">
|
102
|
+
<a href="Seabright/Timestamps/ClassMethods.html">Seabright::Timestamps::ClassMethods</a>
|
103
|
+
</li>
|
104
|
+
<li class="module">
|
105
|
+
<a href="Seabright/Types.html">Seabright::Types</a>
|
106
|
+
</li>
|
107
|
+
<li class="module">
|
108
|
+
<a href="Seabright/Types/ClassMethods.html">Seabright::Types::ClassMethods</a>
|
109
|
+
</li>
|
110
|
+
<li class="class">
|
111
|
+
<a href="Object.html">Object</a>
|
112
|
+
</li>
|
113
|
+
<li class="class">
|
114
|
+
<a href="Seabright/RedisObject.html">Object::RedisObject</a>
|
115
|
+
</li>
|
116
|
+
|
117
|
+
</ul>
|
118
|
+
|
119
|
+
<h2 id="methods">Methods</h2>
|
120
|
+
<ul>
|
121
|
+
|
122
|
+
<li class="method"><a href="Seabright/ExternalIndex.html#method-c-buildthisout">::buildthisout — Seabright::ExternalIndex</a>
|
123
|
+
|
124
|
+
<li class="method"><a href="Seabright/Collections.html#method-c-included">::included — Seabright::Collections</a>
|
125
|
+
|
126
|
+
<li class="method"><a href="Seabright/Template.html#method-c-included">::included — Seabright::Template</a>
|
127
|
+
|
128
|
+
<li class="method"><a href="Seabright/Timestamps.html#method-c-included">::included — Seabright::Timestamps</a>
|
129
|
+
|
130
|
+
<li class="method"><a href="Seabright/Types.html#method-c-included">::included — Seabright::Types</a>
|
131
|
+
|
132
|
+
<li class="method"><a href="Seabright/Indices.html#method-c-included">::included — Seabright::Indices</a>
|
133
|
+
|
134
|
+
<li class="method"><a href="Seabright/Storage.html#method-c-included">::included — Seabright::Storage</a>
|
135
|
+
|
136
|
+
<li class="method"><a href="Seabright/Keys.html#method-c-included">::included — Seabright::Keys</a>
|
137
|
+
|
138
|
+
<li class="method"><a href="Seabright/History.html#method-c-included">::included — Seabright::History</a>
|
139
|
+
|
140
|
+
<li class="method"><a href="Seabright/Collection.html#method-c-load">::load — Seabright::Collection</a>
|
141
|
+
|
142
|
+
<li class="method"><a href="Seabright/Collection.html#method-c-new">::new — Seabright::Collection</a>
|
143
|
+
|
144
|
+
<li class="method"><a href="Seabright/ObjectBase.html#method-c-new">::new — Seabright::ObjectBase</a>
|
145
|
+
|
146
|
+
<li class="method"><a href="Seabright/Collections.html#method-c-new">::new — Seabright::Collections</a>
|
147
|
+
|
148
|
+
<li class="method"><a href="Seabright/Collection.html#method-i-3C-3C">#<< — Seabright::Collection</a>
|
149
|
+
|
150
|
+
<li class="method"><a href="Seabright/Collections.html#method-i-3C-3C">#<< — Seabright::Collections</a>
|
151
|
+
|
152
|
+
<li class="method"><a href="Seabright/ObjectBase.html#method-i-5B-5D">#[] — Seabright::ObjectBase</a>
|
153
|
+
|
154
|
+
<li class="method"><a href="Seabright/Collection.html#method-i-5B-5D">#[] — Seabright::Collection</a>
|
155
|
+
|
156
|
+
<li class="method"><a href="Seabright/ObjectBase.html#method-i-5B-5D-3D">#[]= — Seabright::ObjectBase</a>
|
157
|
+
|
158
|
+
<li class="method"><a href="Seabright/ObjectBase.html#method-i-actual">#actual — Seabright::ObjectBase</a>
|
159
|
+
|
160
|
+
<li class="method"><a href="Seabright/Storage/ClassMethods.html#method-i-adapter">#adapter — Seabright::Storage::ClassMethods</a>
|
161
|
+
|
162
|
+
<li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-all">#all — Seabright::ObjectBase::ClassMethods</a>
|
163
|
+
|
164
|
+
<li class="method"><a href="Seabright/Types/ClassMethods.html#method-i-array">#array — Seabright::Types::ClassMethods</a>
|
165
|
+
|
166
|
+
<li class="method"><a href="Seabright/Types/ClassMethods.html#method-i-bool">#bool — Seabright::Types::ClassMethods</a>
|
167
|
+
|
168
|
+
<li class="method"><a href="Seabright/Collection.html#method-i-class_const">#class_const — Seabright::Collection</a>
|
169
|
+
|
170
|
+
<li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-cname">#cname — Seabright::ObjectBase::ClassMethods</a>
|
171
|
+
|
172
|
+
<li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-create">#create — Seabright::ObjectBase::ClassMethods</a>
|
173
|
+
|
174
|
+
<li class="method"><a href="Seabright/Types/ClassMethods.html#method-i-date">#date — Seabright::Types::ClassMethods</a>
|
175
|
+
|
176
|
+
<li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-dbnum">#dbnum — Seabright::ObjectBase::ClassMethods</a>
|
177
|
+
|
178
|
+
<li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-deep_const_get">#deep_const_get — Seabright::ObjectBase::ClassMethods</a>
|
179
|
+
|
180
|
+
<li class="method"><a href="Seabright/Storage/MySQL.html#method-i-del">#del — Seabright::Storage::MySQL</a>
|
181
|
+
|
182
|
+
<li class="method"><a href="Seabright/Adapter.html#method-i-del">#del — Seabright::Adapter</a>
|
183
|
+
|
184
|
+
<li class="method"><a href="Seabright/Collection.html#method-i-delete">#delete — Seabright::Collection</a>
|
185
|
+
|
186
|
+
<li class="method"><a href="Seabright/ObjectBase.html#method-i-delete-21">#delete! — Seabright::ObjectBase</a>
|
187
|
+
|
188
|
+
<li class="method"><a href="Seabright/Collections.html#method-i-delete_child">#delete_child — Seabright::Collections</a>
|
189
|
+
|
190
|
+
<li class="method"><a href="Seabright/Collections.html#method-i-dump">#dump — Seabright::Collections</a>
|
191
|
+
|
192
|
+
<li class="method"><a href="Seabright/ObjectBase.html#method-i-dump">#dump — Seabright::ObjectBase</a>
|
193
|
+
|
194
|
+
<li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-dump">#dump — Seabright::ObjectBase::ClassMethods</a>
|
195
|
+
|
196
|
+
<li class="method"><a href="Seabright/Collection.html#method-i-each">#each — Seabright::Collection</a>
|
197
|
+
|
198
|
+
<li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-each">#each — Seabright::ObjectBase::ClassMethods</a>
|
199
|
+
|
200
|
+
<li class="method"><a href="Seabright/Types.html#method-i-enforce_format">#enforce_format — Seabright::Types</a>
|
201
|
+
|
202
|
+
<li class="method"><a href="Seabright/Storage/MySQL.html#method-i-exists">#exists — Seabright::Storage::MySQL</a>
|
203
|
+
|
204
|
+
<li class="method"><a href="Seabright/Adapter.html#method-i-exists">#exists — Seabright::Adapter</a>
|
205
|
+
|
206
|
+
<li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-exists-3F">#exists? — Seabright::ObjectBase::ClassMethods</a>
|
207
|
+
|
208
|
+
<li class="method"><a href="Seabright/Collection.html#method-i-find">#find — Seabright::Collection</a>
|
209
|
+
|
210
|
+
<li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-find">#find — Seabright::ObjectBase::ClassMethods</a>
|
211
|
+
|
212
|
+
<li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-find_by_key">#find_by_key — Seabright::ObjectBase::ClassMethods</a>
|
213
|
+
|
214
|
+
<li class="method"><a href="Seabright/Collection.html#method-i-first">#first — Seabright::Collection</a>
|
215
|
+
|
216
|
+
<li class="method"><a href="Seabright/Types.html#method-i-format_array">#format_array — Seabright::Types</a>
|
217
|
+
|
218
|
+
<li class="method"><a href="Seabright/Types.html#method-i-format_boolean">#format_boolean — Seabright::Types</a>
|
219
|
+
|
220
|
+
<li class="method"><a href="Seabright/Types.html#method-i-format_date">#format_date — Seabright::Types</a>
|
221
|
+
|
222
|
+
<li class="method"><a href="Seabright/Types.html#method-i-format_number">#format_number — Seabright::Types</a>
|
223
|
+
|
224
|
+
<li class="method"><a href="Seabright/ObjectBase.html#method-i-generate_id">#generate_id — Seabright::ObjectBase</a>
|
225
|
+
|
226
|
+
<li class="method"><a href="Seabright/Types.html#method-i-get">#get — Seabright::Types</a>
|
227
|
+
|
228
|
+
<li class="method"><a href="Seabright/ObjectBase.html#method-i-get">#get — Seabright::ObjectBase</a>
|
229
|
+
|
230
|
+
<li class="method"><a href="Seabright/Collections.html#method-i-get">#get — Seabright::Collections</a>
|
231
|
+
|
232
|
+
<li class="method"><a href="Seabright/Collections.html#method-i-get_collection">#get_collection — Seabright::Collections</a>
|
233
|
+
|
234
|
+
<li class="method"><a href="Seabright/Collections.html#method-i-has_collection-3F">#has_collection? — Seabright::Collections</a>
|
235
|
+
|
236
|
+
<li class="method"><a href="Seabright/Adapter.html#method-i-hget">#hget — Seabright::Adapter</a>
|
237
|
+
|
238
|
+
<li class="method"><a href="Seabright/Storage/MySQL.html#method-i-hget">#hget — Seabright::Storage::MySQL</a>
|
239
|
+
|
240
|
+
<li class="method"><a href="Seabright/History.html#method-i-history">#history — Seabright::History</a>
|
241
|
+
|
242
|
+
<li class="method"><a href="Seabright/History.html#method-i-history_key">#history_key — Seabright::History</a>
|
243
|
+
|
244
|
+
<li class="method"><a href="Seabright/History/ClassMethods.html#method-i-history_key">#history_key — Seabright::History::ClassMethods</a>
|
245
|
+
|
246
|
+
<li class="method"><a href="Seabright/Keys/ClassMethods.html#method-i-hkey">#hkey — Seabright::Keys::ClassMethods</a>
|
247
|
+
|
248
|
+
<li class="method"><a href="Seabright/Keys.html#method-i-hkey">#hkey — Seabright::Keys</a>
|
249
|
+
|
250
|
+
<li class="method"><a href="Seabright/Collections/ClassMethods.html#method-i-hkey_col">#hkey_col — Seabright::Collections::ClassMethods</a>
|
251
|
+
|
252
|
+
<li class="method"><a href="Seabright/Collections.html#method-i-hkey_col">#hkey_col — Seabright::Collections</a>
|
253
|
+
|
254
|
+
<li class="method"><a href="Seabright/Adapter.html#method-i-hset">#hset — Seabright::Adapter</a>
|
255
|
+
|
256
|
+
<li class="method"><a href="Seabright/Storage/MySQL.html#method-i-hset">#hset — Seabright::Storage::MySQL</a>
|
257
|
+
|
258
|
+
<li class="method"><a href="Seabright/ObjectBase.html#method-i-id">#id — Seabright::ObjectBase</a>
|
259
|
+
|
260
|
+
<li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-id_sym">#id_sym — Seabright::ObjectBase::ClassMethods</a>
|
261
|
+
|
262
|
+
<li class="method"><a href="Seabright/Indices/ClassMethods.html#method-i-index">#index — Seabright::Indices::ClassMethods</a>
|
263
|
+
|
264
|
+
<li class="method"><a href="Seabright/Indices.html#method-i-index_key">#index_key — Seabright::Indices</a>
|
265
|
+
|
266
|
+
<li class="method"><a href="Seabright/Collection.html#method-i-index_key">#index_key — Seabright::Collection</a>
|
267
|
+
|
268
|
+
<li class="method"><a href="Seabright/Collection.html#method-i-indexed">#indexed — Seabright::Collection</a>
|
269
|
+
|
270
|
+
<li class="method"><a href="Seabright/Indices/ClassMethods.html#method-i-indexed">#indexed — Seabright::Indices::ClassMethods</a>
|
271
|
+
|
272
|
+
<li class="method"><a href="Seabright/ObjectBase.html#method-i-inspect">#inspect — Seabright::ObjectBase</a>
|
273
|
+
|
274
|
+
<li class="method"><a href="Seabright/Collection.html#method-i-key">#key — Seabright::Collection</a>
|
275
|
+
|
276
|
+
<li class="method"><a href="Seabright/Keys.html#method-i-key">#key — Seabright::Keys</a>
|
277
|
+
|
278
|
+
<li class="method"><a href="Seabright/Keys/ClassMethods.html#method-i-key">#key — Seabright::Keys::ClassMethods</a>
|
279
|
+
|
280
|
+
<li class="method"><a href="Seabright/Collection.html#method-i-last">#last — Seabright::Collection</a>
|
281
|
+
|
282
|
+
<li class="method"><a href="Seabright/Collections.html#method-i-load">#load — Seabright::Collections</a>
|
283
|
+
|
284
|
+
<li class="method"><a href="Seabright/ObjectBase.html#method-i-load">#load — Seabright::ObjectBase</a>
|
285
|
+
|
286
|
+
<li class="method"><a href="Seabright/Storage/Redis.html#method-i-method_missing">#method_missing — Seabright::Storage::Redis</a>
|
287
|
+
|
288
|
+
<li class="method"><a href="Seabright/ObjectBase.html#method-i-new_id">#new_id — Seabright::ObjectBase</a>
|
289
|
+
|
290
|
+
<li class="method"><a href="Seabright/Types/ClassMethods.html#method-i-number">#number — Seabright::Types::ClassMethods</a>
|
291
|
+
|
292
|
+
<li class="method"><a href="Seabright/Collection.html#method-i-objects">#objects — Seabright::Collection</a>
|
293
|
+
|
294
|
+
<li class="method"><a href="Seabright/ObjectBase.html#method-i-parent">#parent — Seabright::ObjectBase</a>
|
295
|
+
|
296
|
+
<li class="method"><a href="Seabright/ObjectBase.html#method-i-parent-3D">#parent= — Seabright::ObjectBase</a>
|
297
|
+
|
298
|
+
<li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-plname">#plname — Seabright::ObjectBase::ClassMethods</a>
|
299
|
+
|
300
|
+
<li class="method"><a href="Seabright/Collections.html#method-i-push">#push — Seabright::Collections</a>
|
301
|
+
|
302
|
+
<li class="method"><a href="Seabright/Collection.html#method-i-push">#push — Seabright::Collection</a>
|
303
|
+
|
304
|
+
<li class="method"><a href="Seabright/ObjectBase.html#method-i-raw">#raw — Seabright::ObjectBase</a>
|
305
|
+
|
306
|
+
<li class="method"><a href="Seabright/Collection.html#method-i-real_at">#real_at — Seabright::Collection</a>
|
307
|
+
|
308
|
+
<li class="method"><a href="Seabright/Indices/ClassMethods.html#method-i-recently_created">#recently_created — Seabright::Indices::ClassMethods</a>
|
309
|
+
|
310
|
+
<li class="method"><a href="Seabright/Indices/ClassMethods.html#method-i-recently_updated">#recently_updated — Seabright::Indices::ClassMethods</a>
|
311
|
+
|
312
|
+
<li class="method"><a href="Seabright/References.html#method-i-ref_key">#ref_key — Seabright::References</a>
|
313
|
+
|
314
|
+
<li class="method"><a href="Seabright/References.html#method-i-reference">#reference — Seabright::References</a>
|
315
|
+
|
316
|
+
<li class="method"><a href="Seabright/References.html#method-i-referenced_by">#referenced_by — Seabright::References</a>
|
317
|
+
|
318
|
+
<li class="method"><a href="Seabright/ObjectBase.html#method-i-reserve">#reserve — Seabright::ObjectBase</a>
|
319
|
+
|
320
|
+
<li class="method"><a href="Seabright/Keys.html#method-i-reserve_key">#reserve_key — Seabright::Keys</a>
|
321
|
+
|
322
|
+
<li class="method"><a href="Seabright/Keys/ClassMethods.html#method-i-reserve_key">#reserve_key — Seabright::Keys::ClassMethods</a>
|
323
|
+
|
324
|
+
<li class="method"><a href="Seabright/Adapter.html#method-i-sadd">#sadd — Seabright::Adapter</a>
|
325
|
+
|
326
|
+
<li class="method"><a href="Seabright/Storage/MySQL.html#method-i-sadd">#sadd — Seabright::Storage::MySQL</a>
|
327
|
+
|
328
|
+
<li class="method"><a href="Seabright/Collection.html#method-i-save">#save — Seabright::Collection</a>
|
329
|
+
|
330
|
+
<li class="method"><a href="Seabright/Indices.html#method-i-save">#save — Seabright::Indices</a>
|
331
|
+
|
332
|
+
<li class="method"><a href="Seabright/Collections.html#method-i-save">#save — Seabright::Collections</a>
|
333
|
+
|
334
|
+
<li class="method"><a href="Seabright/History.html#method-i-save">#save — Seabright::History</a>
|
335
|
+
|
336
|
+
<li class="method"><a href="Seabright/ObjectBase.html#method-i-save">#save — Seabright::ObjectBase</a>
|
337
|
+
|
338
|
+
<li class="method"><a href="Seabright/Timestamps.html#method-i-save">#save — Seabright::Timestamps</a>
|
339
|
+
|
340
|
+
<li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-save_all">#save_all — Seabright::ObjectBase::ClassMethods</a>
|
341
|
+
|
342
|
+
<li class="method"><a href="Seabright/History/ClassMethods.html#method-i-save_history-21">#save_history! — Seabright::History::ClassMethods</a>
|
343
|
+
|
344
|
+
<li class="method"><a href="Seabright/History.html#method-i-save_history-3F">#save_history? — Seabright::History</a>
|
345
|
+
|
346
|
+
<li class="method"><a href="Seabright/History/ClassMethods.html#method-i-save_history-3F">#save_history? — Seabright::History::ClassMethods</a>
|
347
|
+
|
348
|
+
<li class="method"><a href="Seabright/Indices.html#method-i-save_indices">#save_indices — Seabright::Indices</a>
|
349
|
+
|
350
|
+
<li class="method"><a href="Seabright/Collection.html#method-i-select">#select — Seabright::Collection</a>
|
351
|
+
|
352
|
+
<li class="method"><a href="Seabright/Storage/MySQL.html#method-i-set">#set — Seabright::Storage::MySQL</a>
|
353
|
+
|
354
|
+
<li class="method"><a href="Seabright/Adapter.html#method-i-set">#set — Seabright::Adapter</a>
|
355
|
+
|
356
|
+
<li class="method"><a href="Seabright/ObjectBase.html#method-i-set">#set — Seabright::ObjectBase</a>
|
357
|
+
|
358
|
+
<li class="method"><a href="Seabright/Collections.html#method-i-set">#set — Seabright::Collections</a>
|
359
|
+
|
360
|
+
<li class="method"><a href="Seabright/Storage/ClassMethods.html#method-i-set_storage">#set_storage — Seabright::Storage::ClassMethods</a>
|
361
|
+
|
362
|
+
<li class="method"><a href="Seabright/Adapter.html#method-i-smembers">#smembers — Seabright::Adapter</a>
|
363
|
+
|
364
|
+
<li class="method"><a href="Seabright/Storage/MySQL.html#method-i-smembers">#smembers — Seabright::Storage::MySQL</a>
|
365
|
+
|
366
|
+
<li class="method"><a href="Seabright/Indices/ClassMethods.html#method-i-sort_by">#sort_by — Seabright::Indices::ClassMethods</a>
|
367
|
+
|
368
|
+
<li class="method"><a href="Seabright/Storage/MySQL.html#method-i-srem">#srem — Seabright::Storage::MySQL</a>
|
369
|
+
|
370
|
+
<li class="method"><a href="Seabright/Adapter.html#method-i-srem">#srem — Seabright::Adapter</a>
|
371
|
+
|
372
|
+
<li class="method"><a href="Seabright/Storage.html#method-i-store">#store — Seabright::Storage</a>
|
373
|
+
|
374
|
+
<li class="method"><a href="Seabright/Storage/ClassMethods.html#method-i-store">#store — Seabright::Storage::ClassMethods</a>
|
375
|
+
|
376
|
+
<li class="method"><a href="Seabright/History.html#method-i-store_image">#store_image — Seabright::History</a>
|
377
|
+
|
378
|
+
<li class="method"><a href="Seabright/Timestamps/ClassMethods.html#method-i-time_matters_not-21">#time_matters_not! — Seabright::Timestamps::ClassMethods</a>
|
379
|
+
|
380
|
+
<li class="method"><a href="Seabright/ObjectBase.html#method-i-to_json">#to_json — Seabright::ObjectBase</a>
|
381
|
+
|
382
|
+
<li class="method"><a href="Seabright/Timestamps.html#method-i-update_timestamps">#update_timestamps — Seabright::Timestamps</a>
|
383
|
+
|
384
|
+
<li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-use_dbnum">#use_dbnum — Seabright::ObjectBase::ClassMethods</a>
|
385
|
+
|
386
|
+
</ul>
|
387
|
+
|
388
|
+
|
389
|
+
<footer id="validator-badges">
|
390
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
391
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
392
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
393
|
+
</footer>
|
394
|
+
|
data/lib/redis_object.rb
CHANGED
@@ -4,9 +4,7 @@ require 'yajl'
|
|
4
4
|
|
5
5
|
require "redis_object/storage"
|
6
6
|
|
7
|
-
require "redis_object/ext/script_cache"
|
8
7
|
require "redis_object/base"
|
9
|
-
require "redis_object/inheritance_tracking"
|
10
8
|
require "redis_object/storage"
|
11
9
|
require "redis_object/keys"
|
12
10
|
require "redis_object/types"
|
@@ -14,28 +12,20 @@ require "redis_object/defaults"
|
|
14
12
|
require "redis_object/collection"
|
15
13
|
require "redis_object/indices"
|
16
14
|
require "redis_object/timestamps"
|
17
|
-
require "redis_object/
|
18
|
-
require "redis_object/ext/views"
|
19
|
-
require "redis_object/ext/view_caching"
|
15
|
+
require "redis_object/history"
|
20
16
|
require "redis_object/ext/triggers"
|
21
|
-
require "redis_object/ext/filters"
|
22
17
|
require "redis_object/ext/benchmark"
|
23
18
|
|
24
19
|
module Seabright
|
25
20
|
class RedisObject
|
26
21
|
|
27
|
-
include Seabright::Filters
|
28
22
|
include Seabright::ObjectBase
|
29
|
-
include Seabright::InheritanceTracking
|
30
|
-
include Seabright::CachedScripts
|
31
23
|
include Seabright::Storage
|
32
24
|
include Seabright::Keys
|
33
25
|
include Seabright::Types
|
34
26
|
include Seabright::DefaultValues
|
35
27
|
include Seabright::Collections
|
36
28
|
include Seabright::Indices
|
37
|
-
include Seabright::Views
|
38
|
-
include Seabright::ViewCaching
|
39
29
|
include Seabright::Timestamps
|
40
30
|
include Seabright::History
|
41
31
|
include Seabright::Triggers
|
data/lib/redis_object/base.rb
CHANGED
@@ -3,11 +3,11 @@ module Seabright
|
|
3
3
|
|
4
4
|
def initialize(ident={})
|
5
5
|
if ident && (ident.class == String || (ident.class == Symbol && (ident = ident.to_s)))# && ident.gsub!(/.*:/,'') && ident.length > 0
|
6
|
-
load(ident
|
6
|
+
load(ident)
|
7
7
|
elsif ident && ident.class == Hash
|
8
8
|
ident[id_sym] ||= generate_id
|
9
9
|
if load(ident[id_sym])
|
10
|
-
mset(ident
|
10
|
+
mset(ident)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
self
|
@@ -18,17 +18,33 @@ module Seabright
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def generate_id
|
21
|
-
|
21
|
+
v = new_id
|
22
|
+
while self.class.exists?(v) do
|
23
|
+
puts "[RedisObject] Collision at id: #{v}" if Debug.verbose?
|
24
|
+
v = new_id
|
25
|
+
end
|
26
|
+
puts "[RedisObject] Reserving key: #{v}" if Debug.verbose?
|
27
|
+
reserve(v)
|
28
|
+
v
|
22
29
|
end
|
23
30
|
|
24
31
|
def reserve(k)
|
25
|
-
|
32
|
+
store.set(reserve_key(k),Time.now.to_s)
|
26
33
|
end
|
27
34
|
|
28
35
|
def to_json
|
29
36
|
Yajl::Encoder.encode(actual)
|
30
37
|
end
|
31
38
|
|
39
|
+
def dump
|
40
|
+
require "utf8_utils"
|
41
|
+
out = ["puts \"Creating: #{id}\""]
|
42
|
+
s_id = id.gsub(/\W/,"_")
|
43
|
+
out << "a#{s_id} = #{self.class.cname}.new(#{actual.to_s.tidy_bytes})"
|
44
|
+
out << "a#{s_id}.save"
|
45
|
+
out.join("\n")
|
46
|
+
end
|
47
|
+
|
32
48
|
def id
|
33
49
|
@id || get(id_sym) || set(id_sym, generate_id)
|
34
50
|
end
|
@@ -42,7 +58,7 @@ module Seabright
|
|
42
58
|
set(:class, self.class.name)
|
43
59
|
set(id_sym,id.gsub(/.*:/,''))
|
44
60
|
set(:key, key)
|
45
|
-
store.sadd(self.class.
|
61
|
+
store.sadd(self.class.cname.pluralize, key)
|
46
62
|
store.del(reserve_key)
|
47
63
|
end
|
48
64
|
|
@@ -63,7 +79,7 @@ module Seabright
|
|
63
79
|
def dereference_all!
|
64
80
|
|
65
81
|
end
|
66
|
-
|
82
|
+
|
67
83
|
def raw
|
68
84
|
store.hgetall(hkey).inject({}) {|acc,(k,v)| acc[k.to_sym] = enforce_format(k,v); acc }
|
69
85
|
end
|
@@ -71,163 +87,74 @@ module Seabright
|
|
71
87
|
alias_method :actual, :raw
|
72
88
|
|
73
89
|
def get(k)
|
74
|
-
|
75
|
-
if v = store.hget(hkey, key.to_s)
|
76
|
-
define_setter_getter(key)
|
77
|
-
end
|
78
|
-
v
|
79
|
-
}.call(k)
|
80
|
-
end
|
81
|
-
|
82
|
-
def [](k)
|
83
|
-
get(k)
|
90
|
+
store.hget(hkey, k.to_s)
|
84
91
|
end
|
92
|
+
alias_method :[], :get
|
85
93
|
|
86
94
|
def is_set?(k)
|
87
95
|
store.hexists(hkey, k.to_s)
|
88
96
|
end
|
89
97
|
|
90
98
|
def mset(dat)
|
99
|
+
# dat.each do |k,v|
|
100
|
+
# set(k,v)
|
101
|
+
# end
|
91
102
|
store.hmset(hkey, *(dat.inject([]){|acc,(k,v)| acc + [k,v] }))
|
92
|
-
cached_hash_values.merge!(dat)
|
93
|
-
dat.each do |k,v|
|
94
|
-
define_setter_getter(k)
|
95
|
-
end
|
96
103
|
dat
|
97
104
|
end
|
98
105
|
|
99
|
-
def define_setter_getter(key)
|
100
|
-
define_access(key) do
|
101
|
-
get(key)
|
102
|
-
end
|
103
|
-
define_access("#{key.to_s}=") do |val|
|
104
|
-
set(key,val)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
def undefine_setter_getter(key)
|
109
|
-
undefine_access(key)
|
110
|
-
undefine_access("#{key.to_s}=")
|
111
|
-
end
|
112
|
-
|
113
106
|
def set(k,v)
|
114
|
-
store.hset(hkey, k.to_s, v
|
115
|
-
cached_hash_values[k.to_s] = v
|
116
|
-
define_setter_getter(k)
|
107
|
+
store.hset(hkey, k.to_s.gsub(/\=$/,''), v)
|
117
108
|
v
|
118
109
|
end
|
110
|
+
alias_method :[]=, :set
|
119
111
|
|
120
|
-
def
|
121
|
-
|
122
|
-
cached_hash_values[k.to_s] = v
|
123
|
-
define_setter_getter(k)
|
124
|
-
end
|
125
|
-
success
|
126
|
-
end
|
127
|
-
|
128
|
-
def []=(k,v)
|
129
|
-
set(k,v)
|
112
|
+
def unset(k)
|
113
|
+
store.hdel(hkey, k.to_s)
|
130
114
|
end
|
131
115
|
|
132
116
|
def unset(*k)
|
133
|
-
store.hdel(hkey
|
134
|
-
k.each do |ky|
|
135
|
-
cached_hash_values.delete ky.to_s
|
136
|
-
undefine_setter_getter(ky)
|
137
|
-
end
|
117
|
+
store.hdel(hkey,*k)
|
138
118
|
end
|
119
|
+
# alias_method :delete, :unset
|
139
120
|
|
140
121
|
private
|
141
122
|
|
142
|
-
SetPattern = /=$/.freeze
|
143
|
-
|
144
123
|
def method_missing(sym, *args, &block)
|
145
|
-
|
146
|
-
if sym.to_s =~ SetPattern
|
147
|
-
return super if args.size > 1
|
148
|
-
set(sym.to_s.gsub(SetPattern,'').to_sym,*args)
|
149
|
-
else
|
150
|
-
return super if !args.empty?
|
151
|
-
get(sym)
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
def id_sym(cls=self.class.cname)
|
156
|
-
"#{cls.split('::').last.downcase}_id".to_sym
|
124
|
+
sym.to_s =~ /=$/ ? set(sym,*args) : get(sym)
|
157
125
|
end
|
158
126
|
|
159
|
-
def
|
160
|
-
|
161
|
-
cached_hash_values.keys.dup.each do |key|
|
162
|
-
next if key == "class"
|
163
|
-
define_setter_getter(key)
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
def cached_hash_values
|
168
|
-
@cached_hash_values ||= {}
|
169
|
-
end
|
170
|
-
|
171
|
-
def define_access(key,&block)
|
172
|
-
return if self.respond_to?(key.to_sym)
|
173
|
-
metaclass = class << self; self; end
|
174
|
-
metaclass.send(:define_method, key.to_sym, &block)
|
175
|
-
end
|
176
|
-
|
177
|
-
def undefine_access(key)
|
178
|
-
return unless self.respond_to?(key.to_sym)
|
179
|
-
metaclass = class << self; self; end
|
180
|
-
metaclass.send(:remove_method, key.to_sym)
|
127
|
+
def id_sym(cls=nil)
|
128
|
+
"#{(cls || self.class.cname).split('::').last.downcase}_id".to_sym
|
181
129
|
end
|
182
130
|
|
183
131
|
module ClassMethods
|
184
132
|
|
185
|
-
def generate_id
|
186
|
-
v = new_id
|
187
|
-
while exists?(v) do
|
188
|
-
puts "[RedisObject] Collision at id: #{v}" if Debug.verbose?
|
189
|
-
v = new_id
|
190
|
-
end
|
191
|
-
puts "[RedisObject] Reserving key: #{v}" if Debug.verbose?
|
192
|
-
reserve(v)
|
193
|
-
v
|
194
|
-
end
|
195
|
-
|
196
|
-
def reserve(k)
|
197
|
-
store.set(reserve_key(k),Time.now.to_s)
|
198
|
-
end
|
199
|
-
|
200
133
|
def new_id(complexity = 8)
|
201
134
|
rand(36**complexity).to_s(36)
|
202
135
|
end
|
203
136
|
|
204
137
|
def cname
|
205
|
-
self.name
|
138
|
+
@cname = self.name.split('::').last
|
206
139
|
end
|
207
140
|
|
208
141
|
def plname
|
209
|
-
cname.pluralize
|
142
|
+
@plname ||= cname.pluralize
|
210
143
|
end
|
211
144
|
|
212
145
|
def all
|
213
146
|
Enumerator.new do |y|
|
214
147
|
store.smembers(plname).each do |member|
|
215
|
-
if a = find_by_key(hkey(member))
|
148
|
+
if a = RedisObject.find_by_key(hkey(member))
|
216
149
|
y << a
|
217
150
|
else
|
218
151
|
puts "[#{name}] Object listed but not found: #{member}" if DEBUG
|
219
|
-
store.srem(plname,member)
|
152
|
+
# store.srem(plname,member)
|
220
153
|
end
|
221
154
|
end
|
222
155
|
end
|
223
156
|
end
|
224
157
|
|
225
|
-
def recollect!
|
226
|
-
store.keys("#{name}:*_h").each do |ky|
|
227
|
-
store.sadd(plname,ky.gsub(/_h$/,''))
|
228
|
-
end
|
229
|
-
end
|
230
|
-
|
231
158
|
def first
|
232
159
|
if m = store.smembers(plname)
|
233
160
|
self.grab(m.first)
|
@@ -242,95 +169,25 @@ module Seabright
|
|
242
169
|
end
|
243
170
|
end
|
244
171
|
|
245
|
-
RedisObject::ScriptSources::Matcher = "local itms = redis.call('SMEMBERS',KEYS[1])
|
246
|
-
local out = {}
|
247
|
-
local val
|
248
|
-
local pattern
|
249
|
-
for i, v in ipairs(itms) do
|
250
|
-
val = redis.call('HGET',v..'_h',ARGV[1])
|
251
|
-
if ARGV[2]:find('^pattern:') then
|
252
|
-
pattern = ARGV[2]:gsub('^pattern:','')
|
253
|
-
if val:match(pattern) ~= nil then
|
254
|
-
table.insert(out,itms[i])
|
255
|
-
end
|
256
|
-
else
|
257
|
-
if val == ARGV[2] then
|
258
|
-
table.insert(out,itms[i])
|
259
|
-
end
|
260
|
-
end
|
261
|
-
end
|
262
|
-
return out".gsub(/\t/,'').freeze
|
263
|
-
|
264
|
-
RedisObject::ScriptSources::MultiMatcher = "local itms = redis.call('SMEMBERS',KEYS[1])
|
265
|
-
local out = {}
|
266
|
-
local matchers = {}
|
267
|
-
local matcher = {}
|
268
|
-
local mod
|
269
|
-
for i=1,#ARGV do
|
270
|
-
mod = i % 2
|
271
|
-
if mod == 1 then
|
272
|
-
matcher[1] = ARGV[i]
|
273
|
-
else
|
274
|
-
matcher[2] = ARGV[i]
|
275
|
-
table.insert(matchers,matcher)
|
276
|
-
matcher = {}
|
277
|
-
end
|
278
|
-
end
|
279
|
-
local val
|
280
|
-
local good
|
281
|
-
local pattern
|
282
|
-
for i, v in ipairs(itms) do
|
283
|
-
good = true
|
284
|
-
for n=1,#matchers do
|
285
|
-
val = redis.call('HGET',v..'_h',matchers[n][1])
|
286
|
-
if val then
|
287
|
-
if matchers[n][2]:find('^pattern:') then
|
288
|
-
pattern = matchers[n][2]:gsub('^pattern:','')
|
289
|
-
if val:match(pattern) then
|
290
|
-
good = good
|
291
|
-
else
|
292
|
-
good = false
|
293
|
-
end
|
294
|
-
else
|
295
|
-
if val ~= matchers[n][2] then
|
296
|
-
good = false
|
297
|
-
end
|
298
|
-
end
|
299
|
-
else
|
300
|
-
good = false
|
301
|
-
end
|
302
|
-
end
|
303
|
-
if good == true then
|
304
|
-
table.insert(out,itms[i])
|
305
|
-
end
|
306
|
-
end
|
307
|
-
return out".gsub(/\t/,'').freeze
|
308
|
-
|
309
172
|
def match(pkt)
|
310
173
|
Enumerator.new do |y|
|
311
|
-
|
312
|
-
|
174
|
+
each do |i|
|
175
|
+
if pkt.map {|hk,va| i.get(hk)==va }.all?
|
176
|
+
y << i
|
177
|
+
end
|
313
178
|
end
|
314
179
|
end
|
315
180
|
end
|
316
181
|
|
317
|
-
def convert_regex_to_lua(reg)
|
318
|
-
"pattern:#{reg.source.gsub("\\","")}"
|
319
|
-
end
|
320
|
-
|
321
182
|
def grab(ident)
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
when Hash
|
183
|
+
if ident.class == String
|
184
|
+
return store.exists(self.hkey(ident)) ? self.new(ident) : nil
|
185
|
+
elsif ident.class == Hash
|
326
186
|
return match(ident)
|
327
187
|
end
|
328
188
|
nil
|
329
189
|
end
|
330
|
-
|
331
|
-
def find(ident)
|
332
|
-
grab(ident)
|
333
|
-
end
|
190
|
+
alias_method :find, :grab
|
334
191
|
|
335
192
|
def exists?(k)
|
336
193
|
store.exists(self.hkey(k)) || store.exists(self.reserve_key(k))
|
@@ -342,13 +199,13 @@ module Seabright
|
|
342
199
|
obj
|
343
200
|
end
|
344
201
|
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
202
|
+
def dump
|
203
|
+
out = []
|
204
|
+
each do |obj|
|
205
|
+
out << obj.dump
|
206
|
+
end
|
207
|
+
out.join("\n")
|
208
|
+
end
|
352
209
|
|
353
210
|
def use_dbnum(db=0)
|
354
211
|
@dbnum = db
|
@@ -360,7 +217,8 @@ module Seabright
|
|
360
217
|
|
361
218
|
def find_by_key(k)
|
362
219
|
if store.exists(k) && (cls = store.hget(k,:class))
|
363
|
-
|
220
|
+
o_id = store.hget(k,id_sym(cls))
|
221
|
+
return deep_const_get(cls.to_sym).new(o_id)
|
364
222
|
end
|
365
223
|
nil
|
366
224
|
end
|
@@ -386,16 +244,8 @@ module Seabright
|
|
386
244
|
true
|
387
245
|
end
|
388
246
|
|
389
|
-
def id_sym(cls=
|
390
|
-
"#{cls.split('::').last.downcase}_id".to_sym
|
391
|
-
end
|
392
|
-
|
393
|
-
def describe
|
394
|
-
all_keys.inject({}) do |acc,(k,v)|
|
395
|
-
acc[k.to_sym] ||= [:string, 0]
|
396
|
-
acc[k.to_sym][1] += 1
|
397
|
-
acc
|
398
|
-
end
|
247
|
+
def id_sym(cls=nil)
|
248
|
+
"#{(cls || cname).split('::').last.downcase}_id".to_sym
|
399
249
|
end
|
400
250
|
|
401
251
|
end
|
@@ -405,4 +255,4 @@ module Seabright
|
|
405
255
|
end
|
406
256
|
|
407
257
|
end
|
408
|
-
end
|
258
|
+
end
|