redis_support 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/redis_support/class_extensions.rb +11 -0
- data/test/test_redis_support.rb +16 -0
- metadata +17 -8
@@ -61,5 +61,16 @@ module RedisSupport
|
|
61
61
|
end
|
62
62
|
RUBY
|
63
63
|
end
|
64
|
+
|
65
|
+
def redefine_redis_key( name, keystruct )
|
66
|
+
if Keys.methods.include? name.to_s
|
67
|
+
Keys.class_eval <<-RUBY
|
68
|
+
class << self
|
69
|
+
undef #{name}
|
70
|
+
end
|
71
|
+
RUBY
|
72
|
+
end
|
73
|
+
redis_key(name, keystruct)
|
74
|
+
end
|
64
75
|
end
|
65
76
|
end
|
data/test/test_redis_support.rb
CHANGED
@@ -76,6 +76,22 @@ context "Redis Support" do
|
|
76
76
|
TestClass.redis_key :failure, "test:redis:VAR:VAR:oops"
|
77
77
|
end
|
78
78
|
end
|
79
|
+
|
80
|
+
test "redis keys can be redefined" do
|
81
|
+
assert_equal "test:redis:variable:id:append", TestClass::Keys.test_vars("variable", "id")
|
82
|
+
|
83
|
+
TestClass.redefine_redis_key :test_vars, "new:definition:redis:key:VAR:ID"
|
84
|
+
assert_equal "new:definition:redis:key:variable:id", TestClass::Keys.test_vars("variable", "id")
|
85
|
+
end
|
86
|
+
|
87
|
+
test "a nonexistent key when redefined doesn't fail" do
|
88
|
+
assert_raise(NoMethodError) do
|
89
|
+
TestClass::Keys.test_redefine_notexist("variable", "id")
|
90
|
+
end
|
91
|
+
|
92
|
+
TestClass.redefine_redis_key :test_redefine_notexist, "nonexistent:redis:key:VAR:ID"
|
93
|
+
assert_equal "nonexistent:redis:key:variable:id", TestClass::Keys.test_redefine_notexist("variable", "id")
|
94
|
+
end
|
79
95
|
end
|
80
96
|
|
81
97
|
context "Including Redis Support" do
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 9
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 11
|
10
|
+
version: 0.0.11
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Brian P O'Rourke
|
@@ -15,23 +16,25 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2010-07-
|
19
|
+
date: 2010-07-08 00:00:00 -07:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
23
|
-
|
24
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
+
hash: 31
|
28
29
|
segments:
|
29
30
|
- 1
|
30
31
|
- 0
|
31
32
|
- 4
|
32
33
|
version: 1.0.4
|
34
|
+
type: :runtime
|
35
|
+
name: redis
|
33
36
|
prerelease: false
|
34
|
-
|
37
|
+
version_requirements: *id001
|
35
38
|
description: "Module for adding redis functionality to classes: simple key namespacing and locking and connections"
|
36
39
|
email: dolores@doloreslabs.com
|
37
40
|
executables: []
|
@@ -45,6 +48,8 @@ files:
|
|
45
48
|
- lib/redis_support/class_extensions.rb
|
46
49
|
- lib/redis_support/locks.rb
|
47
50
|
- README.md
|
51
|
+
- test/helper.rb
|
52
|
+
- test/test_redis_support.rb
|
48
53
|
has_rdoc: true
|
49
54
|
homepage: http://github.com/dolores/redis_support
|
50
55
|
licenses: []
|
@@ -55,23 +60,27 @@ rdoc_options:
|
|
55
60
|
require_paths:
|
56
61
|
- lib
|
57
62
|
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
58
64
|
requirements:
|
59
65
|
- - ">="
|
60
66
|
- !ruby/object:Gem::Version
|
67
|
+
hash: 3
|
61
68
|
segments:
|
62
69
|
- 0
|
63
70
|
version: "0"
|
64
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
65
73
|
requirements:
|
66
74
|
- - ">="
|
67
75
|
- !ruby/object:Gem::Version
|
76
|
+
hash: 3
|
68
77
|
segments:
|
69
78
|
- 0
|
70
79
|
version: "0"
|
71
80
|
requirements: []
|
72
81
|
|
73
82
|
rubyforge_project:
|
74
|
-
rubygems_version: 1.3.
|
83
|
+
rubygems_version: 1.3.7
|
75
84
|
signing_key:
|
76
85
|
specification_version: 3
|
77
86
|
summary: A Redis Support module
|