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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d643329ea57aefcf21b2d5f82e10dc2ceb06153
4
- data.tar.gz: 0ee4d20cad2936c1dfb51af9916e2bc7a100cc4a
3
+ metadata.gz: c0b3f159d870fa11917933fad909718b6c25e238
4
+ data.tar.gz: 261b90d914fb16f5d8ba44465e94fa7fc158b7f4
5
5
  SHA512:
6
- metadata.gz: b1f69e41172233934e798c9207bbd3e44b6e6f8d7d5e9767747507b2b8ab900a52274b1ca3c991584ba26a52fd202c68c3a762064ed23d9b3f481d4a391f1363
7
- data.tar.gz: 4b31213c6d961b7520faa62bf38fc1fb0aa69e98ea645536c70834d9bb46dbdaf1f7644be742f1e6b5a6f178c2ac35b2089da30695661683c1dbdb24309ab8f0
6
+ metadata.gz: 3777edbb75e8bebf54fda67050533cd440601ee549b92622784cc6cf8233b4374e026fddd7e3ef3107d5b62bf8027293e52304812b33e892957c0de28089fef2
7
+ data.tar.gz: cc3739cd888b848d71b7e5b828c50585036e34c0dc0a68abc1123d1e18e0c7bac8d99f33578698c798c0d7c5fed1289d5e3f00d5d61e9520c9737eb88dd8db72
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 2.2.0 2014-11-23
2
+
3
+ * Class-level commands are forwarded again
4
+
1
5
  ## 2.1.0 2014-11-23
2
6
 
3
7
  * Lazy connection loading
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
@@ -1,3 +1,3 @@
1
1
  class RedisClassy
2
- VERSION = '2.1.0'
2
+ VERSION = '2.2.0'
3
3
  end
@@ -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.1.0
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-23 00:00:00.000000000 Z
11
+ date: 2014-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis-namespace