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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cbaa4165750c1d833bd0dac513a327659cc03c72
4
- data.tar.gz: 7ad146371f45610ef1452c6c753633365226ddb2
3
+ metadata.gz: 982244cc85b8272f243c4940b0f3859df6cc907c
4
+ data.tar.gz: 132a4968b0986132dee2407ccc33074e1636aeee
5
5
  SHA512:
6
- metadata.gz: 1369ce3fba96daf02ab259c6347f634a3783cb1cd1572dad360b4c0ef02a1944bfbc7b37489776b8dfbb3e02bc815dfa77d69232f250d02c621ea17cc34ec55a
7
- data.tar.gz: d1d1aa2f8cbf21f78a4e7ef85942cb585764c468e05ff97d378c8e2899520d6d804c7664c236fe85bc2ddc6a9a0143a7d3aa519c5a121b64ed0ec17f1374a24a
6
+ metadata.gz: 2925576baa3c467d0048dba8e2faeee10cbe13a82979c307695980729d9bb1f43494e77b696a4b97f12dde4ffbf53ba9d5ea3e71f7ac47c1e91ab6b2d51e2f42
7
+ data.tar.gz: 190130bfae79a303ab083c163d8485cac8e5f779742170ba239772781f678f5a138ad5264b50925b838e626a390c65f1918e846084f8733e5dd917d5a0802dea
data/.travis.yml CHANGED
@@ -3,7 +3,4 @@ services:
3
3
  - redis-server
4
4
  rvm:
5
5
  - 2.0.0
6
- - 2.1.0
7
- - rbx-2
8
6
  - ruby-head
9
- - jruby-head
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
- raise Error.new('RedisClassy.redis must be assigned first')
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
@@ -1,3 +1,3 @@
1
1
  class RedisClassy
2
- VERSION = '2.3.0'
2
+ VERSION = '2.3.1'
3
3
  end
@@ -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([:median, :average])
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.0
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-10-06 00:00:00.000000000 Z
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.5.1
110
+ rubygems_version: 2.6.8
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: Class-style namespace prefixing for Redis