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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGQ0NGY4MDBkY2I2OTY1MTFjMmRjNTY2NDgzZmNjYTk0OTcwMzUyNg==
4
+ NGI2MTI4YzhkODE3NmYzMzM3MjIzNmY3ZDZhMTVjMjkwZTQ0Y2E4Zg==
5
5
  data.tar.gz: !binary |-
6
- MjgyMDg2MDkzNjY0NDJjOWEyN2RkZDQwNDc3NDYzYWU5OTc4M2Q5Mw==
6
+ NGY2NjMxOTJiYTQzZmRhYWI4MzRmNmMxNjUwMGVjNzM2MDU4ZmJhZg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZmFlMmVhOTY2Y2MxOThmN2MzNTVmNjc5MzU0NTNjMzE5OWNlZGNiYzQxMzFm
10
- NjBkZGM1MTEzNzgyMTdhOWY5ODE3ZTBmMjg3NjEyNWZiYjE5NTNiZmUxNWJm
11
- OWEyYTEwMGEyZDU3OWE0YmQwYThiNTc4MzRjOGI4YjgwMGVkZWY=
9
+ OGZiODZhZjZiNzRjNmZkNDhhYTE1YjYwMjNkYjkzYzM0ZTU5ZDJkZjhiYjNm
10
+ YWFlMGE4Y2Y1YTEyYzFmZTZmYzAxY2RhNzQ4MTExNTZiMTM0YzFjNmE1MGMw
11
+ MTkxOTRjMDI1ODM0Y2NmZjcyOWU3N2E1OTJkYjVkZGEyOGQyYWQ=
12
12
  data.tar.gz: !binary |-
13
- NGU4MDUwNDBiMGFhYTA5ODk5NTQ1NGRlOWM4OGUzZWY2YjgzODgyZWIxMTEw
14
- NDE5Y2ZhMjQxYzIzMDQ5NmQwZjY1N2Y4MjY3Yzg5ZDZhOTgwYmQ0MjFkYzY2
15
- MjQ5ZGQwYmQ1OTcyNDU4Y2NkNWNjNzIyYmQzNDU2ODcwMTVkMmM=
13
+ MGM0NDZjODBlZDViMDMyNDFhMGU2MGVhZDU3NzM3MjZmMDEyNzM2OThjYjgw
14
+ MzYxMGIwNTI3MjY2MTIzMDA3NDFmODBlYWRlMjQ1ODgwODI0NTJhYzYxMTJm
15
+ MDQyZjVlMWE4MGIzYzEzNDcwYjZmMDc5YjViOWI4MWNlZTBiMTU=
@@ -4,6 +4,7 @@ require 'yajl'
4
4
  require 'set'
5
5
 
6
6
  require "redis_object/storage"
7
+ require "redis_object/ext/list_enumerator"
7
8
 
8
9
  require "redis_object/ext/script_cache"
9
10
  require "redis_object/base"
@@ -246,7 +246,7 @@ module Seabright
246
246
 
247
247
  def all
248
248
  kys = store.smembers(plname)
249
- Enumerator.new do |y|
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
- Enumerator.new do |y|
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 = Enumerator.new do |y|
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
- Enumerator.new do |y|
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.map {|hk,va| i.get(hk)==va }.all?
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
@@ -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 = Enumerator.new do |yielder|
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
@@ -1,5 +1,5 @@
1
1
  module Seabright
2
2
  class RedisObject
3
- VERSION = "1.3.7"
3
+ VERSION = "1.3.8"
4
4
  end
5
5
  end
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.7
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