nest 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -3
- data/lib/nest.rb +4 -0
- data/nest.gemspec +1 -1
- data/test/nest_test.rb +17 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c49bcf993beed343e77ec05ed5de6f61c086ca50
|
4
|
+
data.tar.gz: f1e5d402a830ca77e80cff1d7e448a17764e4854
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b4e63709cbd146285e53bf7f8bb657d61c783d3f1eb76e7518cec8715fa49ebdeb508fe18dd339e9929bfd9adab21bd978b8ecee2d34fadd9c4302866998c71
|
7
|
+
data.tar.gz: 3ca06dff375b45e9277cc08dc75ba6d6aa068db3f581dc831e80f7c73174138a914bff9c5bbde139916f6f82bffe03a3f89d01bbc8db35f3e4a888bc3773012a
|
data/README.md
CHANGED
@@ -31,6 +31,17 @@ already connected to Redis:
|
|
31
31
|
=> ["Redis Meetup"]
|
32
32
|
```
|
33
33
|
|
34
|
+
Alternatively, you can send the Redis commands as messages to Nest,
|
35
|
+
and if the method definition is missing it will forward the command
|
36
|
+
to Redis:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
>> event = Nest.new("Event")
|
40
|
+
>> event[3].hset("name", "Redis Meetup")
|
41
|
+
>> event[3].hget("name")
|
42
|
+
=> ["Redis Meetup"]
|
43
|
+
```
|
44
|
+
|
34
45
|
Usage
|
35
46
|
-----
|
36
47
|
|
@@ -61,16 +72,16 @@ dealing with events:
|
|
61
72
|
>> event = Nest.new("Event")
|
62
73
|
=> "Event"
|
63
74
|
|
64
|
-
>> id = event[:id].
|
75
|
+
>> id = event[:id].incr
|
65
76
|
=> 1
|
66
77
|
|
67
|
-
>> event[id].
|
78
|
+
>> event[id].hset("name", "Redis Meetup")
|
68
79
|
=> 1
|
69
80
|
|
70
81
|
>> meetup = event[id]
|
71
82
|
=> "Event:1"
|
72
83
|
|
73
|
-
>> meetup.
|
84
|
+
>> meetup.hget("name")
|
74
85
|
=> ["Redis Meetup"]
|
75
86
|
```
|
76
87
|
|
data/lib/nest.rb
CHANGED
data/nest.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "nest"
|
3
|
-
s.version = "3.
|
3
|
+
s.version = "3.1.0"
|
4
4
|
s.summary = "Object-oriented keys for Redis."
|
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.license = "MIT"
|
data/test/nest_test.rb
CHANGED
@@ -34,7 +34,7 @@ scope do
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
# Operating with
|
37
|
+
# Operating with Redis.
|
38
38
|
scope do
|
39
39
|
prepare do
|
40
40
|
@redis = Redic.new
|
@@ -61,3 +61,19 @@ scope do
|
|
61
61
|
assert @redis.object_id == n1["bar"].redis.object_id
|
62
62
|
end
|
63
63
|
end
|
64
|
+
|
65
|
+
|
66
|
+
# Operating with Redis with dynamic methods.
|
67
|
+
scope do
|
68
|
+
prepare do
|
69
|
+
@redis = Redic.new
|
70
|
+
@redis.call("FLUSHDB")
|
71
|
+
end
|
72
|
+
|
73
|
+
test "relay missing methods as Redis commands" do
|
74
|
+
n1 = Nest.new("foo")
|
75
|
+
n1.set("s1")
|
76
|
+
|
77
|
+
assert "s1" == n1.get
|
78
|
+
end
|
79
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michel Martens
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redic
|