nest 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/lib/nest.rb +2 -2
  2. data/nest.gemspec +1 -1
  3. data/test/nest_test.rb +9 -4
  4. metadata +3 -3
@@ -1,5 +1,5 @@
1
1
  class Nest < String
2
- VERSION = "0.0.3"
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,
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "nest"
3
- s.version = "0.0.3"
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"]
@@ -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("s")
56
- n1.append("1")
55
+ n1.set("s1")
57
56
 
58
57
  assert_equal "s1", n1.get
59
- assert_equal "string", n1.type
60
- assert_equal true, n1.exists
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: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michel Martens