redis_object 0.5.0 → 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. data/.gitignore +0 -2
  2. data/Gemfile +0 -4
  3. data/README.markdown +15 -24
  4. data/Rakefile +0 -8
  5. data/doc/Object.html +185 -0
  6. data/doc/Seabright.html +181 -0
  7. data/doc/Seabright/Adapter.html +442 -0
  8. data/doc/Seabright/Collection.html +797 -0
  9. data/doc/Seabright/Collections.html +635 -0
  10. data/doc/Seabright/Collections/ClassMethods.html +212 -0
  11. data/doc/Seabright/ExternalIndex.html +217 -0
  12. data/doc/Seabright/History.html +382 -0
  13. data/doc/Seabright/History/ClassMethods.html +276 -0
  14. data/doc/Seabright/Indices.html +324 -0
  15. data/doc/Seabright/Indices/ClassMethods.html +348 -0
  16. data/doc/Seabright/Keys.html +314 -0
  17. data/doc/Seabright/Keys/ClassMethods.html +276 -0
  18. data/doc/Seabright/ObjectBase.html +852 -0
  19. data/doc/Seabright/ObjectBase/ClassMethods.html +677 -0
  20. data/doc/Seabright/RedisObject.html +230 -0
  21. data/doc/Seabright/References.html +280 -0
  22. data/doc/Seabright/Storage.html +252 -0
  23. data/doc/Seabright/Storage/ClassMethods.html +276 -0
  24. data/doc/Seabright/Storage/MySQL.html +442 -0
  25. data/doc/Seabright/Storage/Redis.html +218 -0
  26. data/doc/Seabright/Template.html +212 -0
  27. data/doc/Seabright/Template/ClassMethods.html +166 -0
  28. data/doc/Seabright/Timestamps.html +292 -0
  29. data/doc/Seabright/Timestamps/ClassMethods.html +214 -0
  30. data/doc/Seabright/Types.html +410 -0
  31. data/doc/Seabright/Types/ClassMethods.html +308 -0
  32. data/doc/created.rid +17 -0
  33. data/doc/images/add.png +0 -0
  34. data/doc/images/brick.png +0 -0
  35. data/doc/images/brick_link.png +0 -0
  36. data/doc/images/bug.png +0 -0
  37. data/doc/images/bullet_black.png +0 -0
  38. data/doc/images/bullet_toggle_minus.png +0 -0
  39. data/doc/images/bullet_toggle_plus.png +0 -0
  40. data/doc/images/date.png +0 -0
  41. data/doc/images/delete.png +0 -0
  42. data/doc/images/find.png +0 -0
  43. data/doc/images/loadingAnimation.gif +0 -0
  44. data/doc/images/macFFBgHack.png +0 -0
  45. data/doc/images/package.png +0 -0
  46. data/doc/images/page_green.png +0 -0
  47. data/doc/images/page_white_text.png +0 -0
  48. data/doc/images/page_white_width.png +0 -0
  49. data/doc/images/plugin.png +0 -0
  50. data/doc/images/ruby.png +0 -0
  51. data/doc/images/tag_blue.png +0 -0
  52. data/doc/images/tag_green.png +0 -0
  53. data/doc/images/transparent.png +0 -0
  54. data/doc/images/wrench.png +0 -0
  55. data/doc/images/wrench_orange.png +0 -0
  56. data/doc/images/zoom.png +0 -0
  57. data/doc/index.html +125 -0
  58. data/doc/js/darkfish.js +153 -0
  59. data/doc/js/jquery.js +18 -0
  60. data/doc/js/navigation.js +142 -0
  61. data/doc/js/search.js +94 -0
  62. data/doc/js/search_index.js +1 -0
  63. data/doc/js/searcher.js +228 -0
  64. data/doc/rdoc.css +543 -0
  65. data/doc/table_of_contents.html +394 -0
  66. data/lib/redis_object.rb +1 -11
  67. data/lib/redis_object/base.rb +60 -210
  68. data/lib/redis_object/collection.rb +100 -130
  69. data/lib/redis_object/defaults.rb +8 -21
  70. data/lib/redis_object/ext/filters.rb +16 -34
  71. data/lib/redis_object/ext/triggers.rb +13 -75
  72. data/lib/redis_object/{experimental/history.rb → history.rb} +0 -0
  73. data/lib/redis_object/indices.rb +39 -44
  74. data/lib/redis_object/keys.rb +4 -4
  75. data/lib/redis_object/storage.rb +1 -30
  76. data/lib/redis_object/storage/adapter.rb +3 -6
  77. data/lib/redis_object/storage/redis.rb +3 -98
  78. data/lib/redis_object/timestamps.rb +21 -42
  79. data/lib/redis_object/types.rb +30 -172
  80. data/lib/redis_object/version.rb +1 -1
  81. data/redis_object.gemspec +0 -1
  82. data/spec/base_spec.rb +6 -41
  83. data/spec/spec_helper.rb +1 -32
  84. metadata +116 -111
  85. data/.coveralls.yml +0 -1
  86. data/.travis.yml +0 -5
  87. data/lib/redis_object/ext/script_cache.rb +0 -92
  88. data/lib/redis_object/ext/shardable.rb +0 -18
  89. data/lib/redis_object/ext/view_caching.rb +0 -258
  90. data/lib/redis_object/ext/views.rb +0 -102
  91. data/lib/redis_object/inheritance_tracking.rb +0 -23
  92. data/spec/adapter_spec.rb +0 -43
  93. data/spec/benchmark_spec.rb +0 -46
  94. data/spec/collections_spec.rb +0 -144
  95. data/spec/defaults_spec.rb +0 -56
  96. data/spec/filters_spec.rb +0 -29
  97. data/spec/indices_spec.rb +0 -45
  98. data/spec/rename_class_spec.rb +0 -96
  99. data/spec/timestamp_spec.rb +0 -28
  100. data/spec/trigger_spec.rb +0 -51
  101. data/spec/types_spec.rb +0 -103
  102. data/spec/view_caching_spec.rb +0 -130
  103. 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 &mdash; Seabright::ExternalIndex</a>
123
+
124
+ <li class="method"><a href="Seabright/Collections.html#method-c-included">::included &mdash; Seabright::Collections</a>
125
+
126
+ <li class="method"><a href="Seabright/Template.html#method-c-included">::included &mdash; Seabright::Template</a>
127
+
128
+ <li class="method"><a href="Seabright/Timestamps.html#method-c-included">::included &mdash; Seabright::Timestamps</a>
129
+
130
+ <li class="method"><a href="Seabright/Types.html#method-c-included">::included &mdash; Seabright::Types</a>
131
+
132
+ <li class="method"><a href="Seabright/Indices.html#method-c-included">::included &mdash; Seabright::Indices</a>
133
+
134
+ <li class="method"><a href="Seabright/Storage.html#method-c-included">::included &mdash; Seabright::Storage</a>
135
+
136
+ <li class="method"><a href="Seabright/Keys.html#method-c-included">::included &mdash; Seabright::Keys</a>
137
+
138
+ <li class="method"><a href="Seabright/History.html#method-c-included">::included &mdash; Seabright::History</a>
139
+
140
+ <li class="method"><a href="Seabright/Collection.html#method-c-load">::load &mdash; Seabright::Collection</a>
141
+
142
+ <li class="method"><a href="Seabright/Collection.html#method-c-new">::new &mdash; Seabright::Collection</a>
143
+
144
+ <li class="method"><a href="Seabright/ObjectBase.html#method-c-new">::new &mdash; Seabright::ObjectBase</a>
145
+
146
+ <li class="method"><a href="Seabright/Collections.html#method-c-new">::new &mdash; Seabright::Collections</a>
147
+
148
+ <li class="method"><a href="Seabright/Collection.html#method-i-3C-3C">#<< &mdash; Seabright::Collection</a>
149
+
150
+ <li class="method"><a href="Seabright/Collections.html#method-i-3C-3C">#<< &mdash; Seabright::Collections</a>
151
+
152
+ <li class="method"><a href="Seabright/ObjectBase.html#method-i-5B-5D">#[] &mdash; Seabright::ObjectBase</a>
153
+
154
+ <li class="method"><a href="Seabright/Collection.html#method-i-5B-5D">#[] &mdash; Seabright::Collection</a>
155
+
156
+ <li class="method"><a href="Seabright/ObjectBase.html#method-i-5B-5D-3D">#[]= &mdash; Seabright::ObjectBase</a>
157
+
158
+ <li class="method"><a href="Seabright/ObjectBase.html#method-i-actual">#actual &mdash; Seabright::ObjectBase</a>
159
+
160
+ <li class="method"><a href="Seabright/Storage/ClassMethods.html#method-i-adapter">#adapter &mdash; Seabright::Storage::ClassMethods</a>
161
+
162
+ <li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-all">#all &mdash; Seabright::ObjectBase::ClassMethods</a>
163
+
164
+ <li class="method"><a href="Seabright/Types/ClassMethods.html#method-i-array">#array &mdash; Seabright::Types::ClassMethods</a>
165
+
166
+ <li class="method"><a href="Seabright/Types/ClassMethods.html#method-i-bool">#bool &mdash; Seabright::Types::ClassMethods</a>
167
+
168
+ <li class="method"><a href="Seabright/Collection.html#method-i-class_const">#class_const &mdash; Seabright::Collection</a>
169
+
170
+ <li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-cname">#cname &mdash; Seabright::ObjectBase::ClassMethods</a>
171
+
172
+ <li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-create">#create &mdash; Seabright::ObjectBase::ClassMethods</a>
173
+
174
+ <li class="method"><a href="Seabright/Types/ClassMethods.html#method-i-date">#date &mdash; Seabright::Types::ClassMethods</a>
175
+
176
+ <li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-dbnum">#dbnum &mdash; Seabright::ObjectBase::ClassMethods</a>
177
+
178
+ <li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-deep_const_get">#deep_const_get &mdash; Seabright::ObjectBase::ClassMethods</a>
179
+
180
+ <li class="method"><a href="Seabright/Storage/MySQL.html#method-i-del">#del &mdash; Seabright::Storage::MySQL</a>
181
+
182
+ <li class="method"><a href="Seabright/Adapter.html#method-i-del">#del &mdash; Seabright::Adapter</a>
183
+
184
+ <li class="method"><a href="Seabright/Collection.html#method-i-delete">#delete &mdash; Seabright::Collection</a>
185
+
186
+ <li class="method"><a href="Seabright/ObjectBase.html#method-i-delete-21">#delete! &mdash; Seabright::ObjectBase</a>
187
+
188
+ <li class="method"><a href="Seabright/Collections.html#method-i-delete_child">#delete_child &mdash; Seabright::Collections</a>
189
+
190
+ <li class="method"><a href="Seabright/Collections.html#method-i-dump">#dump &mdash; Seabright::Collections</a>
191
+
192
+ <li class="method"><a href="Seabright/ObjectBase.html#method-i-dump">#dump &mdash; Seabright::ObjectBase</a>
193
+
194
+ <li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-dump">#dump &mdash; Seabright::ObjectBase::ClassMethods</a>
195
+
196
+ <li class="method"><a href="Seabright/Collection.html#method-i-each">#each &mdash; Seabright::Collection</a>
197
+
198
+ <li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-each">#each &mdash; Seabright::ObjectBase::ClassMethods</a>
199
+
200
+ <li class="method"><a href="Seabright/Types.html#method-i-enforce_format">#enforce_format &mdash; Seabright::Types</a>
201
+
202
+ <li class="method"><a href="Seabright/Storage/MySQL.html#method-i-exists">#exists &mdash; Seabright::Storage::MySQL</a>
203
+
204
+ <li class="method"><a href="Seabright/Adapter.html#method-i-exists">#exists &mdash; Seabright::Adapter</a>
205
+
206
+ <li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-exists-3F">#exists? &mdash; Seabright::ObjectBase::ClassMethods</a>
207
+
208
+ <li class="method"><a href="Seabright/Collection.html#method-i-find">#find &mdash; Seabright::Collection</a>
209
+
210
+ <li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-find">#find &mdash; Seabright::ObjectBase::ClassMethods</a>
211
+
212
+ <li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-find_by_key">#find_by_key &mdash; Seabright::ObjectBase::ClassMethods</a>
213
+
214
+ <li class="method"><a href="Seabright/Collection.html#method-i-first">#first &mdash; Seabright::Collection</a>
215
+
216
+ <li class="method"><a href="Seabright/Types.html#method-i-format_array">#format_array &mdash; Seabright::Types</a>
217
+
218
+ <li class="method"><a href="Seabright/Types.html#method-i-format_boolean">#format_boolean &mdash; Seabright::Types</a>
219
+
220
+ <li class="method"><a href="Seabright/Types.html#method-i-format_date">#format_date &mdash; Seabright::Types</a>
221
+
222
+ <li class="method"><a href="Seabright/Types.html#method-i-format_number">#format_number &mdash; Seabright::Types</a>
223
+
224
+ <li class="method"><a href="Seabright/ObjectBase.html#method-i-generate_id">#generate_id &mdash; Seabright::ObjectBase</a>
225
+
226
+ <li class="method"><a href="Seabright/Types.html#method-i-get">#get &mdash; Seabright::Types</a>
227
+
228
+ <li class="method"><a href="Seabright/ObjectBase.html#method-i-get">#get &mdash; Seabright::ObjectBase</a>
229
+
230
+ <li class="method"><a href="Seabright/Collections.html#method-i-get">#get &mdash; Seabright::Collections</a>
231
+
232
+ <li class="method"><a href="Seabright/Collections.html#method-i-get_collection">#get_collection &mdash; Seabright::Collections</a>
233
+
234
+ <li class="method"><a href="Seabright/Collections.html#method-i-has_collection-3F">#has_collection? &mdash; Seabright::Collections</a>
235
+
236
+ <li class="method"><a href="Seabright/Adapter.html#method-i-hget">#hget &mdash; Seabright::Adapter</a>
237
+
238
+ <li class="method"><a href="Seabright/Storage/MySQL.html#method-i-hget">#hget &mdash; Seabright::Storage::MySQL</a>
239
+
240
+ <li class="method"><a href="Seabright/History.html#method-i-history">#history &mdash; Seabright::History</a>
241
+
242
+ <li class="method"><a href="Seabright/History.html#method-i-history_key">#history_key &mdash; Seabright::History</a>
243
+
244
+ <li class="method"><a href="Seabright/History/ClassMethods.html#method-i-history_key">#history_key &mdash; Seabright::History::ClassMethods</a>
245
+
246
+ <li class="method"><a href="Seabright/Keys/ClassMethods.html#method-i-hkey">#hkey &mdash; Seabright::Keys::ClassMethods</a>
247
+
248
+ <li class="method"><a href="Seabright/Keys.html#method-i-hkey">#hkey &mdash; Seabright::Keys</a>
249
+
250
+ <li class="method"><a href="Seabright/Collections/ClassMethods.html#method-i-hkey_col">#hkey_col &mdash; Seabright::Collections::ClassMethods</a>
251
+
252
+ <li class="method"><a href="Seabright/Collections.html#method-i-hkey_col">#hkey_col &mdash; Seabright::Collections</a>
253
+
254
+ <li class="method"><a href="Seabright/Adapter.html#method-i-hset">#hset &mdash; Seabright::Adapter</a>
255
+
256
+ <li class="method"><a href="Seabright/Storage/MySQL.html#method-i-hset">#hset &mdash; Seabright::Storage::MySQL</a>
257
+
258
+ <li class="method"><a href="Seabright/ObjectBase.html#method-i-id">#id &mdash; Seabright::ObjectBase</a>
259
+
260
+ <li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-id_sym">#id_sym &mdash; Seabright::ObjectBase::ClassMethods</a>
261
+
262
+ <li class="method"><a href="Seabright/Indices/ClassMethods.html#method-i-index">#index &mdash; Seabright::Indices::ClassMethods</a>
263
+
264
+ <li class="method"><a href="Seabright/Indices.html#method-i-index_key">#index_key &mdash; Seabright::Indices</a>
265
+
266
+ <li class="method"><a href="Seabright/Collection.html#method-i-index_key">#index_key &mdash; Seabright::Collection</a>
267
+
268
+ <li class="method"><a href="Seabright/Collection.html#method-i-indexed">#indexed &mdash; Seabright::Collection</a>
269
+
270
+ <li class="method"><a href="Seabright/Indices/ClassMethods.html#method-i-indexed">#indexed &mdash; Seabright::Indices::ClassMethods</a>
271
+
272
+ <li class="method"><a href="Seabright/ObjectBase.html#method-i-inspect">#inspect &mdash; Seabright::ObjectBase</a>
273
+
274
+ <li class="method"><a href="Seabright/Collection.html#method-i-key">#key &mdash; Seabright::Collection</a>
275
+
276
+ <li class="method"><a href="Seabright/Keys.html#method-i-key">#key &mdash; Seabright::Keys</a>
277
+
278
+ <li class="method"><a href="Seabright/Keys/ClassMethods.html#method-i-key">#key &mdash; Seabright::Keys::ClassMethods</a>
279
+
280
+ <li class="method"><a href="Seabright/Collection.html#method-i-last">#last &mdash; Seabright::Collection</a>
281
+
282
+ <li class="method"><a href="Seabright/Collections.html#method-i-load">#load &mdash; Seabright::Collections</a>
283
+
284
+ <li class="method"><a href="Seabright/ObjectBase.html#method-i-load">#load &mdash; Seabright::ObjectBase</a>
285
+
286
+ <li class="method"><a href="Seabright/Storage/Redis.html#method-i-method_missing">#method_missing &mdash; Seabright::Storage::Redis</a>
287
+
288
+ <li class="method"><a href="Seabright/ObjectBase.html#method-i-new_id">#new_id &mdash; Seabright::ObjectBase</a>
289
+
290
+ <li class="method"><a href="Seabright/Types/ClassMethods.html#method-i-number">#number &mdash; Seabright::Types::ClassMethods</a>
291
+
292
+ <li class="method"><a href="Seabright/Collection.html#method-i-objects">#objects &mdash; Seabright::Collection</a>
293
+
294
+ <li class="method"><a href="Seabright/ObjectBase.html#method-i-parent">#parent &mdash; Seabright::ObjectBase</a>
295
+
296
+ <li class="method"><a href="Seabright/ObjectBase.html#method-i-parent-3D">#parent= &mdash; Seabright::ObjectBase</a>
297
+
298
+ <li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-plname">#plname &mdash; Seabright::ObjectBase::ClassMethods</a>
299
+
300
+ <li class="method"><a href="Seabright/Collections.html#method-i-push">#push &mdash; Seabright::Collections</a>
301
+
302
+ <li class="method"><a href="Seabright/Collection.html#method-i-push">#push &mdash; Seabright::Collection</a>
303
+
304
+ <li class="method"><a href="Seabright/ObjectBase.html#method-i-raw">#raw &mdash; Seabright::ObjectBase</a>
305
+
306
+ <li class="method"><a href="Seabright/Collection.html#method-i-real_at">#real_at &mdash; Seabright::Collection</a>
307
+
308
+ <li class="method"><a href="Seabright/Indices/ClassMethods.html#method-i-recently_created">#recently_created &mdash; Seabright::Indices::ClassMethods</a>
309
+
310
+ <li class="method"><a href="Seabright/Indices/ClassMethods.html#method-i-recently_updated">#recently_updated &mdash; Seabright::Indices::ClassMethods</a>
311
+
312
+ <li class="method"><a href="Seabright/References.html#method-i-ref_key">#ref_key &mdash; Seabright::References</a>
313
+
314
+ <li class="method"><a href="Seabright/References.html#method-i-reference">#reference &mdash; Seabright::References</a>
315
+
316
+ <li class="method"><a href="Seabright/References.html#method-i-referenced_by">#referenced_by &mdash; Seabright::References</a>
317
+
318
+ <li class="method"><a href="Seabright/ObjectBase.html#method-i-reserve">#reserve &mdash; Seabright::ObjectBase</a>
319
+
320
+ <li class="method"><a href="Seabright/Keys.html#method-i-reserve_key">#reserve_key &mdash; Seabright::Keys</a>
321
+
322
+ <li class="method"><a href="Seabright/Keys/ClassMethods.html#method-i-reserve_key">#reserve_key &mdash; Seabright::Keys::ClassMethods</a>
323
+
324
+ <li class="method"><a href="Seabright/Adapter.html#method-i-sadd">#sadd &mdash; Seabright::Adapter</a>
325
+
326
+ <li class="method"><a href="Seabright/Storage/MySQL.html#method-i-sadd">#sadd &mdash; Seabright::Storage::MySQL</a>
327
+
328
+ <li class="method"><a href="Seabright/Collection.html#method-i-save">#save &mdash; Seabright::Collection</a>
329
+
330
+ <li class="method"><a href="Seabright/Indices.html#method-i-save">#save &mdash; Seabright::Indices</a>
331
+
332
+ <li class="method"><a href="Seabright/Collections.html#method-i-save">#save &mdash; Seabright::Collections</a>
333
+
334
+ <li class="method"><a href="Seabright/History.html#method-i-save">#save &mdash; Seabright::History</a>
335
+
336
+ <li class="method"><a href="Seabright/ObjectBase.html#method-i-save">#save &mdash; Seabright::ObjectBase</a>
337
+
338
+ <li class="method"><a href="Seabright/Timestamps.html#method-i-save">#save &mdash; Seabright::Timestamps</a>
339
+
340
+ <li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-save_all">#save_all &mdash; Seabright::ObjectBase::ClassMethods</a>
341
+
342
+ <li class="method"><a href="Seabright/History/ClassMethods.html#method-i-save_history-21">#save_history! &mdash; Seabright::History::ClassMethods</a>
343
+
344
+ <li class="method"><a href="Seabright/History.html#method-i-save_history-3F">#save_history? &mdash; Seabright::History</a>
345
+
346
+ <li class="method"><a href="Seabright/History/ClassMethods.html#method-i-save_history-3F">#save_history? &mdash; Seabright::History::ClassMethods</a>
347
+
348
+ <li class="method"><a href="Seabright/Indices.html#method-i-save_indices">#save_indices &mdash; Seabright::Indices</a>
349
+
350
+ <li class="method"><a href="Seabright/Collection.html#method-i-select">#select &mdash; Seabright::Collection</a>
351
+
352
+ <li class="method"><a href="Seabright/Storage/MySQL.html#method-i-set">#set &mdash; Seabright::Storage::MySQL</a>
353
+
354
+ <li class="method"><a href="Seabright/Adapter.html#method-i-set">#set &mdash; Seabright::Adapter</a>
355
+
356
+ <li class="method"><a href="Seabright/ObjectBase.html#method-i-set">#set &mdash; Seabright::ObjectBase</a>
357
+
358
+ <li class="method"><a href="Seabright/Collections.html#method-i-set">#set &mdash; Seabright::Collections</a>
359
+
360
+ <li class="method"><a href="Seabright/Storage/ClassMethods.html#method-i-set_storage">#set_storage &mdash; Seabright::Storage::ClassMethods</a>
361
+
362
+ <li class="method"><a href="Seabright/Adapter.html#method-i-smembers">#smembers &mdash; Seabright::Adapter</a>
363
+
364
+ <li class="method"><a href="Seabright/Storage/MySQL.html#method-i-smembers">#smembers &mdash; Seabright::Storage::MySQL</a>
365
+
366
+ <li class="method"><a href="Seabright/Indices/ClassMethods.html#method-i-sort_by">#sort_by &mdash; Seabright::Indices::ClassMethods</a>
367
+
368
+ <li class="method"><a href="Seabright/Storage/MySQL.html#method-i-srem">#srem &mdash; Seabright::Storage::MySQL</a>
369
+
370
+ <li class="method"><a href="Seabright/Adapter.html#method-i-srem">#srem &mdash; Seabright::Adapter</a>
371
+
372
+ <li class="method"><a href="Seabright/Storage.html#method-i-store">#store &mdash; Seabright::Storage</a>
373
+
374
+ <li class="method"><a href="Seabright/Storage/ClassMethods.html#method-i-store">#store &mdash; Seabright::Storage::ClassMethods</a>
375
+
376
+ <li class="method"><a href="Seabright/History.html#method-i-store_image">#store_image &mdash; Seabright::History</a>
377
+
378
+ <li class="method"><a href="Seabright/Timestamps/ClassMethods.html#method-i-time_matters_not-21">#time_matters_not! &mdash; Seabright::Timestamps::ClassMethods</a>
379
+
380
+ <li class="method"><a href="Seabright/ObjectBase.html#method-i-to_json">#to_json &mdash; Seabright::ObjectBase</a>
381
+
382
+ <li class="method"><a href="Seabright/Timestamps.html#method-i-update_timestamps">#update_timestamps &mdash; Seabright::Timestamps</a>
383
+
384
+ <li class="method"><a href="Seabright/ObjectBase/ClassMethods.html#method-i-use_dbnum">#use_dbnum &mdash; 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
+
@@ -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/experimental/history"
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
@@ -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.dup)
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.dup)
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
- self.class.generate_id
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
- self.class.reserve(k)
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.plname, key)
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
- cached_hash_values[k.to_s] ||= Proc.new {|key|
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.to_s)
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 setnx(k,v)
121
- if success = store.hsetnx(hkey, k.to_s, v.to_s)
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, k.map(&:to_s))
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
- super if sym == :class
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 load_all_hash_values
160
- @cached_hash_values = store.hgetall(hkey)
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
- run_script(pkt.keys.count > 1 ? :MultiMatcher : :Matcher,[plname],pkt.flatten.map{|i| i.is_a?(Regexp) ? convert_regex_to_lua(i) : i.to_s }).each do |k|
312
- y << find(k)
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
- case ident
323
- when String, Symbol
324
- return store.exists(self.hkey(ident.to_s)) ? self.new(ident.to_s) : nil
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
- # def dump
346
- # out = []
347
- # each do |obj|
348
- # out << obj.dump
349
- # end
350
- # out.join("\n")
351
- # end
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
- return deep_const_get(cls.to_sym).new(store.hget(k,id_sym(cls)))
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=cname)
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