nest 0.0.3 → 0.0.4
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.
- data/lib/nest.rb +2 -2
- data/nest.gemspec +1 -1
- data/test/nest_test.rb +9 -4
- metadata +3 -3
data/lib/nest.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class Nest < String
|
2
|
-
VERSION = "0.0.
|
2
|
+
VERSION = "0.0.4"
|
3
3
|
|
4
4
|
def initialize(key, redis = nil)
|
5
5
|
super(key)
|
@@ -7,7 +7,7 @@ class Nest < String
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def [](key)
|
10
|
-
self.class.new("#{self}:#{key}")
|
10
|
+
self.class.new("#{self}:#{key}", redis)
|
11
11
|
end
|
12
12
|
|
13
13
|
[:append, :blpop, :brpop, :decr, :decrby, :del, :exists, :expire,
|
data/nest.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "nest"
|
3
|
-
s.version = "0.0.
|
3
|
+
s.version = "0.0.4"
|
4
4
|
s.summary = "Generate nested namespaced keys for key-value databases."
|
5
5
|
s.description = "It is a design pattern in key-value databases to use the key to simulate structure, and Nest can take care of that."
|
6
6
|
s.authors = ["Michel Martens"]
|
data/test/nest_test.rb
CHANGED
@@ -52,12 +52,17 @@ class TestNest < Test::Unit::TestCase
|
|
52
52
|
|
53
53
|
should "work if a redis instance is supplied" do
|
54
54
|
n1 = Nest.new("foo", @redis)
|
55
|
-
n1.set("
|
56
|
-
n1.append("1")
|
55
|
+
n1.set("s1")
|
57
56
|
|
58
57
|
assert_equal "s1", n1.get
|
59
|
-
|
60
|
-
|
58
|
+
end
|
59
|
+
|
60
|
+
should "pass the redis instance to new keys" do
|
61
|
+
n1 = Nest.new("foo", @redis)
|
62
|
+
n1["bar"].set("s2")
|
63
|
+
|
64
|
+
assert_equal nil, n1.get
|
65
|
+
assert_equal "s2", n1["bar"].get
|
61
66
|
end
|
62
67
|
end
|
63
68
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michel Martens
|