redis-classy 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/UPGRADING.md +0 -2
- data/lib/redis_classy.rb +10 -4
- data/lib/redis_classy/version.rb +1 -1
- data/spec/redis_classy_spec.rb +6 -0
- 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: c0b3f159d870fa11917933fad909718b6c25e238
|
4
|
+
data.tar.gz: 261b90d914fb16f5d8ba44465e94fa7fc158b7f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3777edbb75e8bebf54fda67050533cd440601ee549b92622784cc6cf8233b4374e026fddd7e3ef3107d5b62bf8027293e52304812b33e892957c0de28089fef2
|
7
|
+
data.tar.gz: cc3739cd888b848d71b7e5b828c50585036e34c0dc0a68abc1123d1e18e0c7bac8d99f33578698c798c0d7c5fed1289d5e3f00d5d61e9520c9737eb88dd8db72
|
data/CHANGELOG.md
CHANGED
data/UPGRADING.md
CHANGED
@@ -4,7 +4,5 @@
|
|
4
4
|
|
5
5
|
Please post any implications we may have missed as a GitHub Issue or Pull Request.
|
6
6
|
|
7
|
-
* No redis commands are delegated at the class level. Always use instance methods or explicitly declare singleton.
|
8
|
-
* `Something.set 'key', 'value'` is now `Something.on('key').set('value')`
|
9
7
|
* The base class `Redis::Classy` is now `RedisClassy`.
|
10
8
|
* `Redis::Classy.db = Redis.new` is now `RedisClassy.redis = Redis.new`.
|
data/lib/redis_classy.rb
CHANGED
@@ -2,6 +2,16 @@ class RedisClassy
|
|
2
2
|
class << self
|
3
3
|
attr_writer :redis
|
4
4
|
|
5
|
+
Redis::Namespace::COMMANDS.keys.each do |command|
|
6
|
+
define_method(command) do |*args, &block|
|
7
|
+
if @singleton
|
8
|
+
new('singleton').send(command, *args, &block)
|
9
|
+
else
|
10
|
+
redis.send(command, *args, &block)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
5
15
|
def redis
|
6
16
|
@redis ||= begin
|
7
17
|
if self == RedisClassy
|
@@ -25,10 +35,6 @@ class RedisClassy
|
|
25
35
|
@singleton = true
|
26
36
|
end
|
27
37
|
|
28
|
-
def keys(pattern = nil)
|
29
|
-
redis.keys(pattern || '*')
|
30
|
-
end
|
31
|
-
|
32
38
|
def on(key)
|
33
39
|
new(key)
|
34
40
|
end
|
data/lib/redis_classy/version.rb
CHANGED
data/spec/redis_classy_spec.rb
CHANGED
@@ -117,4 +117,10 @@ describe RedisClassy do
|
|
117
117
|
expect(Stats.median.get).to eq('24')
|
118
118
|
expect(Stats.average.get).to eq('25')
|
119
119
|
end
|
120
|
+
|
121
|
+
it 'handles multiple key commands' do
|
122
|
+
Something.mset :a, 1, :b, 2
|
123
|
+
expect(Something.mget(:a, :b)).to eq(['1', '2'])
|
124
|
+
expect(Something.mapped_mget(:a, :b)).to eq({'a' => '1', 'b' => '2'})
|
125
|
+
end
|
120
126
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-classy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenn Ejima
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis-namespace
|