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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1aceadee837f1ac2bba7fd3840c7c35ffadf777f
4
- data.tar.gz: e82ff489cdde15c5edbe643d64c1a99e80a13d21
3
+ metadata.gz: c49bcf993beed343e77ec05ed5de6f61c086ca50
4
+ data.tar.gz: f1e5d402a830ca77e80cff1d7e448a17764e4854
5
5
  SHA512:
6
- metadata.gz: 2a07fe72c0f5f84a2460767986a3b084a6b5a47bf79cf74841d1c5c34b427c2d321f63f76f81afc36651fa372f77281c0715e5b1ddac04ef94d8befcf4fc5254
7
- data.tar.gz: 788ffc225cc8cf912fa628e949cab221c717cc72628be46f640acfee3a904972886748bfb96bb4cffab5beff1a62b8719b06ec2c6f4695458e4db9347bb5c210
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].call("INCR")
75
+ >> id = event[:id].incr
65
76
  => 1
66
77
 
67
- >> event[id].call("HSET", "name", "Redis Meetup")
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.call("HGET", "name")
84
+ >> meetup.hget("name")
74
85
  => ["Redis Meetup"]
75
86
  ```
76
87
 
@@ -49,4 +49,8 @@ class Nest
49
49
  def inspect
50
50
  @ns.inspect
51
51
  end
52
+
53
+ def method_missing(m, *args)
54
+ call(m, *args)
55
+ end
52
56
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "nest"
3
- s.version = "3.0.0"
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"
@@ -34,7 +34,7 @@ scope do
34
34
  end
35
35
  end
36
36
 
37
- # Operating with redis.
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.0.0
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: 2016-12-03 00:00:00.000000000 Z
11
+ date: 2017-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redic