redis-classy 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -3
- data/lib/redis_classy.rb +4 -1
- data/lib/redis_classy/version.rb +1 -1
- data/spec/redis_classy_spec.rb +8 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 982244cc85b8272f243c4940b0f3859df6cc907c
|
4
|
+
data.tar.gz: 132a4968b0986132dee2407ccc33074e1636aeee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2925576baa3c467d0048dba8e2faeee10cbe13a82979c307695980729d9bb1f43494e77b696a4b97f12dde4ffbf53ba9d5ea3e71f7ac47c1e91ab6b2d51e2f42
|
7
|
+
data.tar.gz: 190130bfae79a303ab083c163d8485cac8e5f779742170ba239772781f678f5a138ad5264b50925b838e626a390c65f1918e846084f8733e5dd917d5a0802dea
|
data/.travis.yml
CHANGED
data/lib/redis_classy.rb
CHANGED
@@ -15,8 +15,11 @@ class RedisClassy
|
|
15
15
|
def redis
|
16
16
|
@redis ||= begin
|
17
17
|
if self == RedisClassy
|
18
|
-
|
18
|
+
# only RedisClassy itself holds the raw non-namespaced Redis instance
|
19
|
+
nil
|
19
20
|
else
|
21
|
+
# subclasses of RedisClassy
|
22
|
+
raise Error.new('RedisClassy.redis must be assigned first') if RedisClassy.redis.nil?
|
20
23
|
Redis::Namespace.new(self.name, redis: RedisClassy.redis)
|
21
24
|
end
|
22
25
|
end
|
data/lib/redis_classy/version.rb
CHANGED
data/spec/redis_classy_spec.rb
CHANGED
@@ -116,7 +116,7 @@ describe RedisClassy do
|
|
116
116
|
Stats.average.set ages.inject(:+)/ages.size
|
117
117
|
expect(Stats.median.get).to eq('24')
|
118
118
|
expect(Stats.average.get).to eq('25')
|
119
|
-
expect(Stats.keys.map(&:to_sym)).to eq([
|
119
|
+
expect([:average, :median] - Stats.keys.map(&:to_sym)).to eq([])
|
120
120
|
expect(Stats.singletons_keys).to eq([:median, :average])
|
121
121
|
end
|
122
122
|
|
@@ -125,4 +125,11 @@ describe RedisClassy do
|
|
125
125
|
expect(Something.mget(:a, :b)).to eq(['1', '2'])
|
126
126
|
expect(Something.mapped_mget(:a, :b)).to eq({'a' => '1', 'b' => '2'})
|
127
127
|
end
|
128
|
+
|
129
|
+
it 'allows conditional assignment' do
|
130
|
+
RedisClassy.redis = nil
|
131
|
+
expect {
|
132
|
+
RedisClassy.redis ||= Redis.new(db: 15)
|
133
|
+
}.to_not raise_error
|
134
|
+
end
|
128
135
|
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.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenn Ejima
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis-namespace
|
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
109
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.
|
110
|
+
rubygems_version: 2.6.8
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: Class-style namespace prefixing for Redis
|