redis_object 1.3.6 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/redis_object/base.rb +30 -7
- data/lib/redis_object/version.rb +1 -1
- data/spec/base_spec.rb +12 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZGQ0NGY4MDBkY2I2OTY1MTFjMmRjNTY2NDgzZmNjYTk0OTcwMzUyNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjgyMDg2MDkzNjY0NDJjOWEyN2RkZDQwNDc3NDYzYWU5OTc4M2Q5Mw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmFlMmVhOTY2Y2MxOThmN2MzNTVmNjc5MzU0NTNjMzE5OWNlZGNiYzQxMzFm
|
10
|
+
NjBkZGM1MTEzNzgyMTdhOWY5ODE3ZTBmMjg3NjEyNWZiYjE5NTNiZmUxNWJm
|
11
|
+
OWEyYTEwMGEyZDU3OWE0YmQwYThiNTc4MzRjOGI4YjgwMGVkZWY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NGU4MDUwNDBiMGFhYTA5ODk5NTQ1NGRlOWM4OGUzZWY2YjgzODgyZWIxMTEw
|
14
|
+
NDE5Y2ZhMjQxYzIzMDQ5NmQwZjY1N2Y4MjY3Yzg5ZDZhOTgwYmQ0MjFkYzY2
|
15
|
+
MjQ5ZGQwYmQ1OTcyNDU4Y2NkNWNjNzIyYmQzNDU2ODcwMTVkMmM=
|
data/lib/redis_object/base.rb
CHANGED
@@ -278,19 +278,27 @@ module Seabright
|
|
278
278
|
end
|
279
279
|
end
|
280
280
|
|
281
|
+
NilPattern = 'nilpattern:'
|
282
|
+
|
281
283
|
RedisObject::ScriptSources::Matcher = "local itms = redis.call('SMEMBERS',KEYS[1])
|
282
284
|
local out = {}
|
283
285
|
local val
|
284
286
|
local pattern
|
285
287
|
for i, v in ipairs(itms) do
|
286
288
|
val = redis.call('HGET',v..'_h',ARGV[1])
|
287
|
-
if
|
288
|
-
|
289
|
-
|
290
|
-
|
289
|
+
if val then
|
290
|
+
if ARGV[2]:find('^pattern:') then
|
291
|
+
pattern = ARGV[2]:gsub('^pattern:','')
|
292
|
+
if val:match(pattern) ~= nil then
|
293
|
+
table.insert(out,itms[i])
|
294
|
+
end
|
295
|
+
else
|
296
|
+
if val == ARGV[2] then
|
297
|
+
table.insert(out,itms[i])
|
298
|
+
end
|
291
299
|
end
|
292
300
|
else
|
293
|
-
if
|
301
|
+
if ARGV[2] == '#{NilPattern}' then
|
294
302
|
table.insert(out,itms[i])
|
295
303
|
end
|
296
304
|
end
|
@@ -333,7 +341,11 @@ module Seabright
|
|
333
341
|
end
|
334
342
|
end
|
335
343
|
else
|
336
|
-
|
344
|
+
if matchers[n][2] == '#{NilPattern}' then
|
345
|
+
good = true
|
346
|
+
else
|
347
|
+
good = false
|
348
|
+
end
|
337
349
|
end
|
338
350
|
end
|
339
351
|
if good == true then
|
@@ -343,7 +355,18 @@ module Seabright
|
|
343
355
|
return out".gsub(/\t/,'').freeze
|
344
356
|
|
345
357
|
def match(pkt)
|
346
|
-
|
358
|
+
mtchr = pkt.keys.count > 1 ? :MultiMatcher : :Matcher
|
359
|
+
pkt = pkt.flatten.map do |i|
|
360
|
+
case i
|
361
|
+
when Regexp
|
362
|
+
convert_regex_to_lua(i)
|
363
|
+
when NilClass
|
364
|
+
NilPattern
|
365
|
+
else
|
366
|
+
i.to_s
|
367
|
+
end
|
368
|
+
end
|
369
|
+
kys = run_script(mtchr,[plname],pkt)
|
347
370
|
Enumerator.new do |y|
|
348
371
|
kys.each do |k|
|
349
372
|
y << find(k)
|
data/lib/redis_object/version.rb
CHANGED
data/spec/base_spec.rb
CHANGED
@@ -45,9 +45,19 @@ describe RedisObject do
|
|
45
45
|
|
46
46
|
it "should be found by complex matchers" do
|
47
47
|
obj = ObjectTests::User.find(user_id: "test")
|
48
|
-
obj.should_not be_nil
|
48
|
+
obj.first.should_not be_nil
|
49
49
|
obj = ObjectTests::User.find(user_id: /test/)
|
50
|
-
obj.should_not be_nil
|
50
|
+
obj.first.should_not be_nil
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should be found by nil matchers" do
|
54
|
+
obj = ObjectTests::User.find(blah: nil)
|
55
|
+
obj.first.should_not be_nil
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should be found by regex matchers that do not exist as keys" do
|
59
|
+
obj = ObjectTests::User.find(blah: /test/)
|
60
|
+
obj.first.should be_nil
|
51
61
|
end
|
52
62
|
|
53
63
|
it "can recollect objects" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Bragg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: utf8_utils
|