redis_object 1.3.7 → 1.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/redis_object.rb +1 -0
- data/lib/redis_object/base.rb +2 -2
- data/lib/redis_object/collection.rb +3 -3
- data/lib/redis_object/ext/list_enumerator.rb +21 -0
- data/lib/redis_object/indices.rb +1 -1
- data/lib/redis_object/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NGI2MTI4YzhkODE3NmYzMzM3MjIzNmY3ZDZhMTVjMjkwZTQ0Y2E4Zg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NGY2NjMxOTJiYTQzZmRhYWI4MzRmNmMxNjUwMGVjNzM2MDU4ZmJhZg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OGZiODZhZjZiNzRjNmZkNDhhYTE1YjYwMjNkYjkzYzM0ZTU5ZDJkZjhiYjNm
|
10
|
+
YWFlMGE4Y2Y1YTEyYzFmZTZmYzAxY2RhNzQ4MTExNTZiMTM0YzFjNmE1MGMw
|
11
|
+
MTkxOTRjMDI1ODM0Y2NmZjcyOWU3N2E1OTJkYjVkZGEyOGQyYWQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MGM0NDZjODBlZDViMDMyNDFhMGU2MGVhZDU3NzM3MjZmMDEyNzM2OThjYjgw
|
14
|
+
MzYxMGIwNTI3MjY2MTIzMDA3NDFmODBlYWRlMjQ1ODgwODI0NTJhYzYxMTJm
|
15
|
+
MDQyZjVlMWE4MGIzYzEzNDcwYjZmMDc5YjViOWI4MWNlZTBiMTU=
|
data/lib/redis_object.rb
CHANGED
data/lib/redis_object/base.rb
CHANGED
@@ -246,7 +246,7 @@ module Seabright
|
|
246
246
|
|
247
247
|
def all
|
248
248
|
kys = store.smembers(plname)
|
249
|
-
|
249
|
+
ListEnumerator.new(kys) do |y|
|
250
250
|
kys.each do |member|
|
251
251
|
if a = find_by_key(hkey(member))
|
252
252
|
y << a
|
@@ -367,7 +367,7 @@ module Seabright
|
|
367
367
|
end
|
368
368
|
end
|
369
369
|
kys = run_script(mtchr,[plname],pkt)
|
370
|
-
|
370
|
+
ListEnumerator.new(kys) do |y|
|
371
371
|
kys.each do |k|
|
372
372
|
y << find(k)
|
373
373
|
end
|
@@ -218,7 +218,7 @@ module Seabright
|
|
218
218
|
|
219
219
|
def indexed(idx,num=-1,reverse=false)
|
220
220
|
keys = keys_by_index(idx,num,reverse)
|
221
|
-
out =
|
221
|
+
out = ListEnumerator.new(keys) do |y|
|
222
222
|
keys.each do |member|
|
223
223
|
if a = class_const.find_by_key(member)
|
224
224
|
y << a
|
@@ -243,7 +243,7 @@ module Seabright
|
|
243
243
|
|
244
244
|
def keys_by_index(idx,num=-1,reverse=false)
|
245
245
|
keys = run_script(reverse ? :RevScript : :FwdScript, [temp_key, index_key(idx), key, num])
|
246
|
-
|
246
|
+
ListEnumerator.new(keys) do |y|
|
247
247
|
keys.each do |member|
|
248
248
|
y << member
|
249
249
|
end
|
@@ -276,7 +276,7 @@ module Seabright
|
|
276
276
|
def match(pkt)
|
277
277
|
Enumerator.new do |y|
|
278
278
|
each do |i|
|
279
|
-
if pkt.
|
279
|
+
if pkt.all? {|hk,va| i.get(hk)==va }
|
280
280
|
y << i
|
281
281
|
end
|
282
282
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class ListEnumerator < Enumerator
|
2
|
+
|
3
|
+
def initialize(base,&block)
|
4
|
+
@base = base
|
5
|
+
super(&block)
|
6
|
+
end
|
7
|
+
|
8
|
+
def count
|
9
|
+
@base.size
|
10
|
+
end
|
11
|
+
|
12
|
+
def member?(obj)
|
13
|
+
case obj
|
14
|
+
when String
|
15
|
+
@base.member?(obj)
|
16
|
+
else
|
17
|
+
super(obj)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
data/lib/redis_object/indices.rb
CHANGED
@@ -46,7 +46,7 @@ module Seabright
|
|
46
46
|
|
47
47
|
def indexed(idx,num=-1,reverse=false)
|
48
48
|
kys = store.send(reverse ? :zrevrange : :zrange, index_key(idx), 0, num-1)
|
49
|
-
out =
|
49
|
+
out = ListEnumerator.new(kys) do |yielder|
|
50
50
|
kys.each do |member|
|
51
51
|
if a = self.find_by_key(member)
|
52
52
|
yielder << a
|
data/lib/redis_object/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis_object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Bragg
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- lib/redis_object/ext/benchmark.rb
|
105
105
|
- lib/redis_object/ext/cleaner.rb
|
106
106
|
- lib/redis_object/ext/filters.rb
|
107
|
+
- lib/redis_object/ext/list_enumerator.rb
|
107
108
|
- lib/redis_object/ext/sanitization.rb
|
108
109
|
- lib/redis_object/ext/script_cache.rb
|
109
110
|
- lib/redis_object/ext/shardable.rb
|