redis 3.0.1 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,24 @@
1
+ # 3.0.2 (unreleased)
2
+
3
+ * Unescape CGI escaped password in URL.
4
+
5
+ * Fix test to check availability of `UNIXSocket`.
6
+
7
+ * Fix handling of score = +/- infinity for sorted set commands.
8
+
9
+ * Replace array splats with concatenation where possible.
10
+
11
+ * Raise if `EXEC` returns an error.
12
+
13
+ * Passing a nil value in options hash no longer overwrites the default.
14
+
15
+ * Allow string keys in options hash passed to `Redis.new` or
16
+ `Redis.connect`.
17
+
18
+ * Fix uncaught error triggering unrelated error (synchrony driver).
19
+
20
+ See f7ffd5f1a628029691084de69e5b46699bb8b96d and #248.
21
+
1
22
  # 3.0.1
2
23
 
3
24
  * Fix reconnect logic not kicking in on a write error.
data/README.md CHANGED
@@ -163,7 +163,7 @@ It is best to use hiredis when you have large replies (for example:
163
163
  In your Gemfile, include hiredis:
164
164
 
165
165
  ```ruby
166
- gem "redis", "~> 3.0.0.rc2"
166
+ gem "redis", "~> 3.0.1"
167
167
  gem "hiredis", "~> 0.4.5"
168
168
  ```
169
169
 
@@ -186,12 +186,12 @@ protocol.
186
186
  In your Gemfile, include em-synchrony and hiredis:
187
187
 
188
188
  ```ruby
189
- gem "redis", "~> 3.0.0.rc2"
189
+ gem "redis", "~> 3.0.1"
190
190
  gem "hiredis", "~> 0.4.5"
191
191
  gem "em-synchrony"
192
192
  ```
193
193
 
194
- When instantiating the client object, specify hiredis:
194
+ When instantiating the client object, specify synchrony:
195
195
 
196
196
  ```ruby
197
197
  redis = Redis.new(:driver => :synchrony)
@@ -15,17 +15,23 @@ redis = Redis.new
15
15
 
16
16
  trap(:INT) { puts; exit }
17
17
 
18
- redis.subscribe(:one, :two) do |on|
19
- on.subscribe do |channel, subscriptions|
20
- puts "Subscribed to ##{channel} (#{subscriptions} subscriptions)"
21
- end
22
-
23
- on.message do |channel, message|
24
- puts "##{channel}: #{message}"
25
- redis.unsubscribe if message == "exit"
26
- end
27
-
28
- on.unsubscribe do |channel, subscriptions|
29
- puts "Unsubscribed from ##{channel} (#{subscriptions} subscriptions)"
18
+ begin
19
+ redis.subscribe(:one, :two) do |on|
20
+ on.subscribe do |channel, subscriptions|
21
+ puts "Subscribed to ##{channel} (#{subscriptions} subscriptions)"
22
+ end
23
+
24
+ on.message do |channel, message|
25
+ puts "##{channel}: #{message}"
26
+ redis.unsubscribe if message == "exit"
27
+ end
28
+
29
+ on.unsubscribe do |channel, subscriptions|
30
+ puts "Unsubscribed from ##{channel} (#{subscriptions} subscriptions)"
31
+ end
30
32
  end
33
+ rescue Redis::BaseConnectionError => error
34
+ puts "#{error}, retrying in 1s"
35
+ sleep 1
36
+ retry
31
37
  end
@@ -55,7 +55,7 @@ class Redis
55
55
  # @return [String] `OK`
56
56
  def auth(password)
57
57
  synchronize do |client|
58
- client.call [:auth, password]
58
+ client.call([:auth, password])
59
59
  end
60
60
  end
61
61
 
@@ -66,7 +66,7 @@ class Redis
66
66
  def select(db)
67
67
  synchronize do |client|
68
68
  client.db = db
69
- client.call [:select, db]
69
+ client.call([:select, db])
70
70
  end
71
71
  end
72
72
 
@@ -75,7 +75,7 @@ class Redis
75
75
  # @return [String] `PONG`
76
76
  def ping
77
77
  synchronize do |client|
78
- client.call [:ping]
78
+ client.call([:ping])
79
79
  end
80
80
  end
81
81
 
@@ -85,7 +85,7 @@ class Redis
85
85
  # @return [String]
86
86
  def echo(value)
87
87
  synchronize do |client|
88
- client.call [:echo, value]
88
+ client.call([:echo, value])
89
89
  end
90
90
  end
91
91
 
@@ -95,7 +95,7 @@ class Redis
95
95
  def quit
96
96
  synchronize do |client|
97
97
  begin
98
- client.call [:quit]
98
+ client.call([:quit])
99
99
  rescue ConnectionError
100
100
  ensure
101
101
  client.disconnect
@@ -108,7 +108,7 @@ class Redis
108
108
  # @return [String] `OK`
109
109
  def bgrewriteaof
110
110
  synchronize do |client|
111
- client.call [:bgrewriteaof]
111
+ client.call([:bgrewriteaof])
112
112
  end
113
113
  end
114
114
 
@@ -117,7 +117,7 @@ class Redis
117
117
  # @return [String] `OK`
118
118
  def bgsave
119
119
  synchronize do |client|
120
- client.call [:bgsave]
120
+ client.call([:bgsave])
121
121
  end
122
122
  end
123
123
 
@@ -128,9 +128,9 @@ class Redis
128
128
  # property with `CONFIG GET`
129
129
  def config(action, *args)
130
130
  synchronize do |client|
131
- client.call [:config, action, *args] do |reply|
131
+ client.call([:config, action] + args) do |reply|
132
132
  if reply.kind_of?(Array) && action == :get
133
- Hash[*reply]
133
+ Hash[reply.each_slice(2).to_a]
134
134
  else
135
135
  reply
136
136
  end
@@ -143,13 +143,13 @@ class Redis
143
143
  # @return [Fixnum]
144
144
  def dbsize
145
145
  synchronize do |client|
146
- client.call [:dbsize]
146
+ client.call([:dbsize])
147
147
  end
148
148
  end
149
149
 
150
150
  def debug(*args)
151
151
  synchronize do |client|
152
- client.call [:debug, *args]
152
+ client.call([:debug] + args)
153
153
  end
154
154
  end
155
155
 
@@ -158,7 +158,7 @@ class Redis
158
158
  # @return [String] `OK`
159
159
  def flushall
160
160
  synchronize do |client|
161
- client.call [:flushall]
161
+ client.call([:flushall])
162
162
  end
163
163
  end
164
164
 
@@ -167,7 +167,7 @@ class Redis
167
167
  # @return [String] `OK`
168
168
  def flushdb
169
169
  synchronize do |client|
170
- client.call [:flushdb]
170
+ client.call([:flushdb])
171
171
  end
172
172
  end
173
173
 
@@ -177,7 +177,7 @@ class Redis
177
177
  # @return [Hash<String, String>]
178
178
  def info(cmd = nil)
179
179
  synchronize do |client|
180
- client.call [:info, cmd].compact do |reply|
180
+ client.call([:info, cmd].compact) do |reply|
181
181
  if reply.kind_of?(String)
182
182
  reply = Hash[reply.split("\r\n").map do |line|
183
183
  line.split(":", 2) unless line =~ /^(#|$)/
@@ -186,7 +186,8 @@ class Redis
186
186
  if cmd && cmd.to_s == "commandstats"
187
187
  # Extract nested hashes for INFO COMMANDSTATS
188
188
  reply = Hash[reply.map do |k, v|
189
- [k[/^cmdstat_(.*)$/, 1], Hash[*v.split(/,|=/)]]
189
+ v = v.split(",").map { |e| e.split("=") }
190
+ [k[/^cmdstat_(.*)$/, 1], Hash[v]]
190
191
  end]
191
192
  end
192
193
  end
@@ -201,7 +202,7 @@ class Redis
201
202
  # @return [Fixnum]
202
203
  def lastsave
203
204
  synchronize do |client|
204
- client.call [:lastsave]
205
+ client.call([:lastsave])
205
206
  end
206
207
  end
207
208
 
@@ -222,7 +223,7 @@ class Redis
222
223
  # @return [String]
223
224
  def save
224
225
  synchronize do |client|
225
- client.call [:save]
226
+ client.call([:save])
226
227
  end
227
228
  end
228
229
 
@@ -231,7 +232,7 @@ class Redis
231
232
  synchronize do |client|
232
233
  client.with_reconnect(false) do
233
234
  begin
234
- client.call [:shutdown]
235
+ client.call([:shutdown])
235
236
  rescue ConnectionError
236
237
  # This means Redis has probably exited.
237
238
  nil
@@ -243,7 +244,7 @@ class Redis
243
244
  # Make the server a slave of another instance, or promote it as master.
244
245
  def slaveof(host, port)
245
246
  synchronize do |client|
246
- client.call [:slaveof, host, port]
247
+ client.call([:slaveof, host, port])
247
248
  end
248
249
  end
249
250
 
@@ -263,7 +264,7 @@ class Redis
263
264
  # Internal command used for replication.
264
265
  def sync
265
266
  synchronize do |client|
266
- client.call [:sync]
267
+ client.call([:sync])
267
268
  end
268
269
  end
269
270
 
@@ -276,7 +277,7 @@ class Redis
276
277
  # microseconds in the current second
277
278
  def time
278
279
  synchronize do |client|
279
- client.call [:time] do |reply|
280
+ client.call([:time]) do |reply|
280
281
  reply.map(&:to_i) if reply
281
282
  end
282
283
  end
@@ -288,7 +289,7 @@ class Redis
288
289
  # @return [Boolean] whether the timeout was removed or not
289
290
  def persist(key)
290
291
  synchronize do |client|
291
- client.call [:persist, key], &_boolify
292
+ client.call([:persist, key], &_boolify)
292
293
  end
293
294
  end
294
295
 
@@ -299,7 +300,7 @@ class Redis
299
300
  # @return [Boolean] whether the timeout was set or not
300
301
  def expire(key, seconds)
301
302
  synchronize do |client|
302
- client.call [:expire, key, seconds], &_boolify
303
+ client.call([:expire, key, seconds], &_boolify)
303
304
  end
304
305
  end
305
306
 
@@ -310,7 +311,7 @@ class Redis
310
311
  # @return [Boolean] whether the timeout was set or not
311
312
  def expireat(key, unix_time)
312
313
  synchronize do |client|
313
- client.call [:expireat, key, unix_time], &_boolify
314
+ client.call([:expireat, key, unix_time], &_boolify)
314
315
  end
315
316
  end
316
317
 
@@ -321,7 +322,7 @@ class Redis
321
322
  # key does not exist or does not have a timeout
322
323
  def ttl(key)
323
324
  synchronize do |client|
324
- client.call [:ttl, key]
325
+ client.call([:ttl, key])
325
326
  end
326
327
  end
327
328
 
@@ -332,7 +333,7 @@ class Redis
332
333
  # @return [Boolean] whether the timeout was set or not
333
334
  def pexpire(key, milliseconds)
334
335
  synchronize do |client|
335
- client.call [:pexpire, key, milliseconds], &_boolify
336
+ client.call([:pexpire, key, milliseconds], &_boolify)
336
337
  end
337
338
  end
338
339
 
@@ -343,7 +344,7 @@ class Redis
343
344
  # @return [Boolean] whether the timeout was set or not
344
345
  def pexpireat(key, ms_unix_time)
345
346
  synchronize do |client|
346
- client.call [:pexpireat, key, ms_unix_time], &_boolify
347
+ client.call([:pexpireat, key, ms_unix_time], &_boolify)
347
348
  end
348
349
  end
349
350
 
@@ -354,7 +355,7 @@ class Redis
354
355
  # key does not exist or does not have a timeout
355
356
  def pttl(key)
356
357
  synchronize do |client|
357
- client.call [:pttl, key]
358
+ client.call([:pttl, key])
358
359
  end
359
360
  end
360
361
 
@@ -364,7 +365,7 @@ class Redis
364
365
  # @return [Fixnum] number of keys that were deleted
365
366
  def del(*keys)
366
367
  synchronize do |client|
367
- client.call [:del, *keys]
368
+ client.call([:del] + keys)
368
369
  end
369
370
  end
370
371
 
@@ -374,7 +375,7 @@ class Redis
374
375
  # @return [Boolean]
375
376
  def exists(key)
376
377
  synchronize do |client|
377
- client.call [:exists, key], &_boolify
378
+ client.call([:exists, key], &_boolify)
378
379
  end
379
380
  end
380
381
 
@@ -384,7 +385,7 @@ class Redis
384
385
  # @return [Array<String>]
385
386
  def keys(pattern = "*")
386
387
  synchronize do |client|
387
- client.call [:keys, pattern] do |reply|
388
+ client.call([:keys, pattern]) do |reply|
388
389
  if reply.kind_of?(String)
389
390
  reply.split(" ")
390
391
  else
@@ -415,13 +416,13 @@ class Redis
415
416
  # @return [Boolean] whether the key was moved or not
416
417
  def move(key, db)
417
418
  synchronize do |client|
418
- client.call [:move, key, db], &_boolify
419
+ client.call([:move, key, db], &_boolify)
419
420
  end
420
421
  end
421
422
 
422
423
  def object(*args)
423
424
  synchronize do |client|
424
- client.call [:object, *args]
425
+ client.call([:object] + args)
425
426
  end
426
427
  end
427
428
 
@@ -430,7 +431,7 @@ class Redis
430
431
  # @return [String]
431
432
  def randomkey
432
433
  synchronize do |client|
433
- client.call [:randomkey]
434
+ client.call([:randomkey])
434
435
  end
435
436
  end
436
437
 
@@ -441,7 +442,7 @@ class Redis
441
442
  # @return [String] `OK`
442
443
  def rename(old_name, new_name)
443
444
  synchronize do |client|
444
- client.call [:rename, old_name, new_name]
445
+ client.call([:rename, old_name, new_name])
445
446
  end
446
447
  end
447
448
 
@@ -452,7 +453,7 @@ class Redis
452
453
  # @return [Boolean] whether the key was renamed or not
453
454
  def renamenx(old_name, new_name)
454
455
  synchronize do |client|
455
- client.call [:renamenx, old_name, new_name], &_boolify
456
+ client.call([:renamenx, old_name, new_name], &_boolify)
456
457
  end
457
458
  end
458
459
 
@@ -485,22 +486,22 @@ class Redis
485
486
  args = []
486
487
 
487
488
  by = options[:by]
488
- args.concat ["BY", by] if by
489
+ args.concat(["BY", by]) if by
489
490
 
490
491
  limit = options[:limit]
491
- args.concat ["LIMIT", *limit] if limit
492
+ args.concat(["LIMIT"] + limit) if limit
492
493
 
493
494
  get = Array(options[:get])
494
- args.concat ["GET"].product(get).flatten unless get.empty?
495
+ args.concat(["GET"].product(get).flatten) unless get.empty?
495
496
 
496
497
  order = options[:order]
497
- args.concat order.split(" ") if order
498
+ args.concat(order.split(" ")) if order
498
499
 
499
500
  store = options[:store]
500
- args.concat ["STORE", store] if store
501
+ args.concat(["STORE", store]) if store
501
502
 
502
503
  synchronize do |client|
503
- client.call [:sort, key, *args] do |reply|
504
+ client.call([:sort, key] + args) do |reply|
504
505
  if get.size > 1
505
506
  if reply
506
507
  reply.each_slice(get.size).to_a
@@ -518,7 +519,7 @@ class Redis
518
519
  # @return [String] `string`, `list`, `set`, `zset`, `hash` or `none`
519
520
  def type(key)
520
521
  synchronize do |client|
521
- client.call [:type, key]
522
+ client.call([:type, key])
522
523
  end
523
524
  end
524
525
 
@@ -532,7 +533,7 @@ class Redis
532
533
  # @return [Fixnum] value after decrementing it
533
534
  def decr(key)
534
535
  synchronize do |client|
535
- client.call [:decr, key]
536
+ client.call([:decr, key])
536
537
  end
537
538
  end
538
539
 
@@ -547,7 +548,7 @@ class Redis
547
548
  # @return [Fixnum] value after decrementing it
548
549
  def decrby(key, decrement)
549
550
  synchronize do |client|
550
- client.call [:decrby, key, decrement]
551
+ client.call([:decrby, key, decrement])
551
552
  end
552
553
  end
553
554
 
@@ -561,7 +562,7 @@ class Redis
561
562
  # @return [Fixnum] value after incrementing it
562
563
  def incr(key)
563
564
  synchronize do |client|
564
- client.call [:incr, key]
565
+ client.call([:incr, key])
565
566
  end
566
567
  end
567
568
 
@@ -576,7 +577,7 @@ class Redis
576
577
  # @return [Fixnum] value after incrementing it
577
578
  def incrby(key, increment)
578
579
  synchronize do |client|
579
- client.call [:incrby, key, increment]
580
+ client.call([:incrby, key, increment])
580
581
  end
581
582
  end
582
583
 
@@ -591,8 +592,8 @@ class Redis
591
592
  # @return [Float] value after incrementing it
592
593
  def incrbyfloat(key, increment)
593
594
  synchronize do |client|
594
- client.call [:incrbyfloat, key, increment] do |reply|
595
- Float(reply) if reply
595
+ client.call([:incrbyfloat, key, increment]) do |reply|
596
+ _floatify(reply) if reply
596
597
  end
597
598
  end
598
599
  end
@@ -604,7 +605,7 @@ class Redis
604
605
  # @return `"OK"`
605
606
  def set(key, value)
606
607
  synchronize do |client|
607
- client.call [:set, key, value]
608
+ client.call([:set, key, value])
608
609
  end
609
610
  end
610
611
 
@@ -618,7 +619,7 @@ class Redis
618
619
  # @return `"OK"`
619
620
  def setex(key, ttl, value)
620
621
  synchronize do |client|
621
- client.call [:setex, key, ttl, value]
622
+ client.call([:setex, key, ttl, value])
622
623
  end
623
624
  end
624
625
 
@@ -630,7 +631,7 @@ class Redis
630
631
  # @return `"OK"`
631
632
  def psetex(key, ttl, value)
632
633
  synchronize do |client|
633
- client.call [:psetex, key, ttl, value]
634
+ client.call([:psetex, key, ttl, value])
634
635
  end
635
636
  end
636
637
 
@@ -641,7 +642,7 @@ class Redis
641
642
  # @return [Boolean] whether the key was set or not
642
643
  def setnx(key, value)
643
644
  synchronize do |client|
644
- client.call [:setnx, key, value], &_boolify
645
+ client.call([:setnx, key, value], &_boolify)
645
646
  end
646
647
  end
647
648
 
@@ -657,7 +658,7 @@ class Redis
657
658
  # @see #mapped_mset
658
659
  def mset(*args)
659
660
  synchronize do |client|
660
- client.call [:mset, *args]
661
+ client.call([:mset] + args)
661
662
  end
662
663
  end
663
664
 
@@ -672,7 +673,7 @@ class Redis
672
673
  #
673
674
  # @see #mset
674
675
  def mapped_mset(hash)
675
- mset(*hash.to_a.flatten)
676
+ mset(hash.to_a.flatten)
676
677
  end
677
678
 
678
679
  # Set one or more values, only if none of the keys exist.
@@ -687,7 +688,7 @@ class Redis
687
688
  # @see #mapped_msetnx
688
689
  def msetnx(*args)
689
690
  synchronize do |client|
690
- client.call [:msetnx, *args], &_boolify
691
+ client.call([:msetnx] + args, &_boolify)
691
692
  end
692
693
  end
693
694
 
@@ -702,7 +703,7 @@ class Redis
702
703
  #
703
704
  # @see #msetnx
704
705
  def mapped_msetnx(hash)
705
- msetnx(*hash.to_a.flatten)
706
+ msetnx(hash.to_a.flatten)
706
707
  end
707
708
 
708
709
  # Get the value of a key.
@@ -711,7 +712,7 @@ class Redis
711
712
  # @return [String]
712
713
  def get(key)
713
714
  synchronize do |client|
714
- client.call [:get, key]
715
+ client.call([:get, key])
715
716
  end
716
717
  end
717
718
 
@@ -729,7 +730,7 @@ class Redis
729
730
  # @see #mapped_mget
730
731
  def mget(*keys, &blk)
731
732
  synchronize do |client|
732
- client.call [:mget, *keys], &blk
733
+ client.call([:mget] + keys, &blk)
733
734
  end
734
735
  end
735
736
 
@@ -746,11 +747,7 @@ class Redis
746
747
  def mapped_mget(*keys)
747
748
  mget(*keys) do |reply|
748
749
  if reply.kind_of?(Array)
749
- hash = Hash.new
750
- keys.zip(reply).each do |field, value|
751
- hash[field] = value
752
- end
753
- hash
750
+ Hash[keys.zip(reply)]
754
751
  else
755
752
  reply
756
753
  end
@@ -765,7 +762,7 @@ class Redis
765
762
  # @return [Fixnum] length of the string after it was modified
766
763
  def setrange(key, offset, value)
767
764
  synchronize do |client|
768
- client.call [:setrange, key, offset, value]
765
+ client.call([:setrange, key, offset, value])
769
766
  end
770
767
  end
771
768
 
@@ -778,7 +775,7 @@ class Redis
778
775
  # @return [Fixnum] `0` or `1`
779
776
  def getrange(key, start, stop)
780
777
  synchronize do |client|
781
- client.call [:getrange, key, start, stop]
778
+ client.call([:getrange, key, start, stop])
782
779
  end
783
780
  end
784
781
 
@@ -790,7 +787,7 @@ class Redis
790
787
  # @return [Fixnum] the original bit value stored at `offset`
791
788
  def setbit(key, offset, value)
792
789
  synchronize do |client|
793
- client.call [:setbit, key, offset, value]
790
+ client.call([:setbit, key, offset, value])
794
791
  end
795
792
  end
796
793
 
@@ -801,7 +798,7 @@ class Redis
801
798
  # @return [Fixnum] `0` or `1`
802
799
  def getbit(key, offset)
803
800
  synchronize do |client|
804
- client.call [:getbit, key, offset]
801
+ client.call([:getbit, key, offset])
805
802
  end
806
803
  end
807
804
 
@@ -812,7 +809,7 @@ class Redis
812
809
  # @return [Fixnum] length of the string after appending
813
810
  def append(key, value)
814
811
  synchronize do |client|
815
- client.call [:append, key, value]
812
+ client.call([:append, key, value])
816
813
  end
817
814
  end
818
815
 
@@ -824,7 +821,7 @@ class Redis
824
821
  # did not exist
825
822
  def getset(key, value)
826
823
  synchronize do |client|
827
- client.call [:getset, key, value]
824
+ client.call([:getset, key, value])
828
825
  end
829
826
  end
830
827
 
@@ -835,7 +832,7 @@ class Redis
835
832
  # if the key does not exist
836
833
  def strlen(key)
837
834
  synchronize do |client|
838
- client.call [:strlen, key]
835
+ client.call([:strlen, key])
839
836
  end
840
837
  end
841
838
 
@@ -845,7 +842,7 @@ class Redis
845
842
  # @return [Fixnum]
846
843
  def llen(key)
847
844
  synchronize do |client|
848
- client.call [:llen, key]
845
+ client.call([:llen, key])
849
846
  end
850
847
  end
851
848
 
@@ -856,7 +853,7 @@ class Redis
856
853
  # @return [Fixnum] the length of the list after the push operation
857
854
  def lpush(key, value)
858
855
  synchronize do |client|
859
- client.call [:lpush, key, value]
856
+ client.call([:lpush, key, value])
860
857
  end
861
858
  end
862
859
 
@@ -867,7 +864,7 @@ class Redis
867
864
  # @return [Fixnum] the length of the list after the push operation
868
865
  def lpushx(key, value)
869
866
  synchronize do |client|
870
- client.call [:lpushx, key, value]
867
+ client.call([:lpushx, key, value])
871
868
  end
872
869
  end
873
870
 
@@ -878,7 +875,7 @@ class Redis
878
875
  # @return [Fixnum] the length of the list after the push operation
879
876
  def rpush(key, value)
880
877
  synchronize do |client|
881
- client.call [:rpush, key, value]
878
+ client.call([:rpush, key, value])
882
879
  end
883
880
  end
884
881
 
@@ -889,7 +886,7 @@ class Redis
889
886
  # @return [Fixnum] the length of the list after the push operation
890
887
  def rpushx(key, value)
891
888
  synchronize do |client|
892
- client.call [:rpushx, key, value]
889
+ client.call([:rpushx, key, value])
893
890
  end
894
891
  end
895
892
 
@@ -899,7 +896,7 @@ class Redis
899
896
  # @return [String]
900
897
  def lpop(key)
901
898
  synchronize do |client|
902
- client.call [:lpop, key]
899
+ client.call([:lpop, key])
903
900
  end
904
901
  end
905
902
 
@@ -909,7 +906,7 @@ class Redis
909
906
  # @return [String]
910
907
  def rpop(key)
911
908
  synchronize do |client|
912
- client.call [:rpop, key]
909
+ client.call([:rpop, key])
913
910
  end
914
911
  end
915
912
 
@@ -920,7 +917,7 @@ class Redis
920
917
  # @return [nil, String] the element, or nil when the source key does not exist
921
918
  def rpoplpush(source, destination)
922
919
  synchronize do |client|
923
- client.call [:rpoplpush, source, destination]
920
+ client.call([:rpoplpush, source, destination])
924
921
  end
925
922
  end
926
923
 
@@ -943,7 +940,7 @@ class Redis
943
940
  timeout = options[:timeout] || 0
944
941
 
945
942
  synchronize do |client|
946
- client.call_without_timeout [cmd, keys, timeout]
943
+ client.call_without_timeout([cmd, keys, timeout])
947
944
  end
948
945
  end
949
946
 
@@ -1009,7 +1006,7 @@ class Redis
1009
1006
  timeout = options[:timeout] || 0
1010
1007
 
1011
1008
  synchronize do |client|
1012
- client.call_without_timeout [:brpoplpush, source, destination, timeout]
1009
+ client.call_without_timeout([:brpoplpush, source, destination, timeout])
1013
1010
  end
1014
1011
  end
1015
1012
 
@@ -1020,7 +1017,7 @@ class Redis
1020
1017
  # @return [String]
1021
1018
  def lindex(key, index)
1022
1019
  synchronize do |client|
1023
- client.call [:lindex, key, index]
1020
+ client.call([:lindex, key, index])
1024
1021
  end
1025
1022
  end
1026
1023
 
@@ -1034,7 +1031,7 @@ class Redis
1034
1031
  # when the element `pivot` was not found
1035
1032
  def linsert(key, where, pivot, value)
1036
1033
  synchronize do |client|
1037
- client.call [:linsert, key, where, pivot, value]
1034
+ client.call([:linsert, key, where, pivot, value])
1038
1035
  end
1039
1036
  end
1040
1037
 
@@ -1046,7 +1043,7 @@ class Redis
1046
1043
  # @return [Array<String>]
1047
1044
  def lrange(key, start, stop)
1048
1045
  synchronize do |client|
1049
- client.call [:lrange, key, start, stop]
1046
+ client.call([:lrange, key, start, stop])
1050
1047
  end
1051
1048
  end
1052
1049
 
@@ -1061,7 +1058,7 @@ class Redis
1061
1058
  # @return [Fixnum] the number of removed elements
1062
1059
  def lrem(key, count, value)
1063
1060
  synchronize do |client|
1064
- client.call [:lrem, key, count, value]
1061
+ client.call([:lrem, key, count, value])
1065
1062
  end
1066
1063
  end
1067
1064
 
@@ -1073,7 +1070,7 @@ class Redis
1073
1070
  # @return [String] `OK`
1074
1071
  def lset(key, index, value)
1075
1072
  synchronize do |client|
1076
- client.call [:lset, key, index, value]
1073
+ client.call([:lset, key, index, value])
1077
1074
  end
1078
1075
  end
1079
1076
 
@@ -1085,7 +1082,7 @@ class Redis
1085
1082
  # @return [String] `OK`
1086
1083
  def ltrim(key, start, stop)
1087
1084
  synchronize do |client|
1088
- client.call [:ltrim, key, start, stop]
1085
+ client.call([:ltrim, key, start, stop])
1089
1086
  end
1090
1087
  end
1091
1088
 
@@ -1095,7 +1092,7 @@ class Redis
1095
1092
  # @return [Fixnum]
1096
1093
  def scard(key)
1097
1094
  synchronize do |client|
1098
- client.call [:scard, key]
1095
+ client.call([:scard, key])
1099
1096
  end
1100
1097
  end
1101
1098
 
@@ -1109,7 +1106,7 @@ class Redis
1109
1106
  # successfully added
1110
1107
  def sadd(key, member)
1111
1108
  synchronize do |client|
1112
- client.call [:sadd, key, member] do |reply|
1109
+ client.call([:sadd, key, member]) do |reply|
1113
1110
  if member.is_a? Array
1114
1111
  # Variadic: return integer
1115
1112
  reply
@@ -1131,7 +1128,7 @@ class Redis
1131
1128
  # successfully removed
1132
1129
  def srem(key, member)
1133
1130
  synchronize do |client|
1134
- client.call [:srem, key, member] do |reply|
1131
+ client.call([:srem, key, member]) do |reply|
1135
1132
  if member.is_a? Array
1136
1133
  # Variadic: return integer
1137
1134
  reply
@@ -1149,7 +1146,7 @@ class Redis
1149
1146
  # @return [String]
1150
1147
  def spop(key)
1151
1148
  synchronize do |client|
1152
- client.call [:spop, key]
1149
+ client.call([:spop, key])
1153
1150
  end
1154
1151
  end
1155
1152
 
@@ -1159,7 +1156,7 @@ class Redis
1159
1156
  # @return [String]
1160
1157
  def srandmember(key)
1161
1158
  synchronize do |client|
1162
- client.call [:srandmember, key]
1159
+ client.call([:srandmember, key])
1163
1160
  end
1164
1161
  end
1165
1162
 
@@ -1171,7 +1168,7 @@ class Redis
1171
1168
  # @return [Boolean]
1172
1169
  def smove(source, destination, member)
1173
1170
  synchronize do |client|
1174
- client.call [:smove, source, destination, member], &_boolify
1171
+ client.call([:smove, source, destination, member], &_boolify)
1175
1172
  end
1176
1173
  end
1177
1174
 
@@ -1182,7 +1179,7 @@ class Redis
1182
1179
  # @return [Boolean]
1183
1180
  def sismember(key, member)
1184
1181
  synchronize do |client|
1185
- client.call [:sismember, key, member], &_boolify
1182
+ client.call([:sismember, key, member], &_boolify)
1186
1183
  end
1187
1184
  end
1188
1185
 
@@ -1192,7 +1189,7 @@ class Redis
1192
1189
  # @return [Array<String>]
1193
1190
  def smembers(key)
1194
1191
  synchronize do |client|
1195
- client.call [:smembers, key]
1192
+ client.call([:smembers, key])
1196
1193
  end
1197
1194
  end
1198
1195
 
@@ -1202,7 +1199,7 @@ class Redis
1202
1199
  # @return [Array<String>] members in the difference
1203
1200
  def sdiff(*keys)
1204
1201
  synchronize do |client|
1205
- client.call [:sdiff, *keys]
1202
+ client.call([:sdiff] + keys)
1206
1203
  end
1207
1204
  end
1208
1205
 
@@ -1213,7 +1210,7 @@ class Redis
1213
1210
  # @return [Fixnum] number of elements in the resulting set
1214
1211
  def sdiffstore(destination, *keys)
1215
1212
  synchronize do |client|
1216
- client.call [:sdiffstore, destination, *keys]
1213
+ client.call([:sdiffstore, destination] + keys)
1217
1214
  end
1218
1215
  end
1219
1216
 
@@ -1223,7 +1220,7 @@ class Redis
1223
1220
  # @return [Array<String>] members in the intersection
1224
1221
  def sinter(*keys)
1225
1222
  synchronize do |client|
1226
- client.call [:sinter, *keys]
1223
+ client.call([:sinter] + keys)
1227
1224
  end
1228
1225
  end
1229
1226
 
@@ -1234,7 +1231,7 @@ class Redis
1234
1231
  # @return [Fixnum] number of elements in the resulting set
1235
1232
  def sinterstore(destination, *keys)
1236
1233
  synchronize do |client|
1237
- client.call [:sinterstore, destination, *keys]
1234
+ client.call([:sinterstore, destination] + keys)
1238
1235
  end
1239
1236
  end
1240
1237
 
@@ -1244,7 +1241,7 @@ class Redis
1244
1241
  # @return [Array<String>] members in the union
1245
1242
  def sunion(*keys)
1246
1243
  synchronize do |client|
1247
- client.call [:sunion, *keys]
1244
+ client.call([:sunion] + keys)
1248
1245
  end
1249
1246
  end
1250
1247
 
@@ -1255,7 +1252,7 @@ class Redis
1255
1252
  # @return [Fixnum] number of elements in the resulting set
1256
1253
  def sunionstore(destination, *keys)
1257
1254
  synchronize do |client|
1258
- client.call [:sunionstore, destination, *keys]
1255
+ client.call([:sunionstore, destination] + keys)
1259
1256
  end
1260
1257
  end
1261
1258
 
@@ -1269,7 +1266,7 @@ class Redis
1269
1266
  # @return [Fixnum]
1270
1267
  def zcard(key)
1271
1268
  synchronize do |client|
1272
- client.call [:zcard, key]
1269
+ client.call([:zcard, key])
1273
1270
  end
1274
1271
  end
1275
1272
 
@@ -1295,10 +1292,10 @@ class Redis
1295
1292
  synchronize do |client|
1296
1293
  if args.size == 1 && args[0].is_a?(Array)
1297
1294
  # Variadic: return integer
1298
- client.call [:zadd, key] + args[0]
1295
+ client.call([:zadd, key] + args[0])
1299
1296
  elsif args.size == 2
1300
1297
  # Single pair: return boolean
1301
- client.call [:zadd, key, args[0], args[1]], &_boolify
1298
+ client.call([:zadd, key, args[0], args[1]], &_boolify)
1302
1299
  else
1303
1300
  raise ArgumentError, "wrong number of arguments"
1304
1301
  end
@@ -1317,8 +1314,8 @@ class Redis
1317
1314
  # @return [Float] score of the member after incrementing it
1318
1315
  def zincrby(key, increment, member)
1319
1316
  synchronize do |client|
1320
- client.call [:zincrby, key, increment, member] do |reply|
1321
- Float(reply) if reply
1317
+ client.call([:zincrby, key, increment, member]) do |reply|
1318
+ _floatify(reply) if reply
1322
1319
  end
1323
1320
  end
1324
1321
  end
@@ -1342,7 +1339,7 @@ class Redis
1342
1339
  # members that were removed to the sorted set
1343
1340
  def zrem(key, member)
1344
1341
  synchronize do |client|
1345
- client.call [:zrem, key, member] do |reply|
1342
+ client.call([:zrem, key, member]) do |reply|
1346
1343
  if member.is_a? Array
1347
1344
  # Variadic: return integer
1348
1345
  reply
@@ -1365,8 +1362,8 @@ class Redis
1365
1362
  # @return [Float] score of the member
1366
1363
  def zscore(key, member)
1367
1364
  synchronize do |client|
1368
- client.call [:zscore, key, member] do |reply|
1369
- Float(reply) if reply
1365
+ client.call([:zscore, key, member]) do |reply|
1366
+ _floatify(reply) if reply
1370
1367
  end
1371
1368
  end
1372
1369
  end
@@ -1396,11 +1393,11 @@ class Redis
1396
1393
  args << "WITHSCORES" if with_scores
1397
1394
 
1398
1395
  synchronize do |client|
1399
- client.call [:zrange, key, start, stop, *args] do |reply|
1396
+ client.call([:zrange, key, start, stop] + args) do |reply|
1400
1397
  if with_scores
1401
1398
  if reply
1402
1399
  reply.each_slice(2).map do |member, score|
1403
- [member, Float(score)]
1400
+ [member, _floatify(score)]
1404
1401
  end
1405
1402
  end
1406
1403
  else
@@ -1428,11 +1425,11 @@ class Redis
1428
1425
  args << "WITHSCORES" if with_scores
1429
1426
 
1430
1427
  synchronize do |client|
1431
- client.call [:zrevrange, key, start, stop, *args] do |reply|
1428
+ client.call([:zrevrange, key, start, stop] + args) do |reply|
1432
1429
  if with_scores
1433
1430
  if reply
1434
1431
  reply.each_slice(2).map do |member, score|
1435
- [member, Float(score)]
1432
+ [member, _floatify(score)]
1436
1433
  end
1437
1434
  end
1438
1435
  else
@@ -1449,7 +1446,7 @@ class Redis
1449
1446
  # @return [Fixnum]
1450
1447
  def zrank(key, member)
1451
1448
  synchronize do |client|
1452
- client.call [:zrank, key, member]
1449
+ client.call([:zrank, key, member])
1453
1450
  end
1454
1451
  end
1455
1452
 
@@ -1461,7 +1458,7 @@ class Redis
1461
1458
  # @return [Fixnum]
1462
1459
  def zrevrank(key, member)
1463
1460
  synchronize do |client|
1464
- client.call [:zrevrank, key, member]
1461
+ client.call([:zrevrank, key, member])
1465
1462
  end
1466
1463
  end
1467
1464
 
@@ -1480,7 +1477,7 @@ class Redis
1480
1477
  # @return [Fixnum] number of members that were removed
1481
1478
  def zremrangebyrank(key, start, stop)
1482
1479
  synchronize do |client|
1483
- client.call [:zremrangebyrank, key, start, stop]
1480
+ client.call([:zremrangebyrank, key, start, stop])
1484
1481
  end
1485
1482
  end
1486
1483
 
@@ -1515,17 +1512,17 @@ class Redis
1515
1512
  args = []
1516
1513
 
1517
1514
  with_scores = options[:with_scores] || options[:withscores]
1518
- args.concat ["WITHSCORES"] if with_scores
1515
+ args.concat(["WITHSCORES"]) if with_scores
1519
1516
 
1520
1517
  limit = options[:limit]
1521
- args.concat ["LIMIT", *limit] if limit
1518
+ args.concat(["LIMIT"] + limit) if limit
1522
1519
 
1523
1520
  synchronize do |client|
1524
- client.call [:zrangebyscore, key, min, max, *args] do |reply|
1521
+ client.call([:zrangebyscore, key, min, max] + args) do |reply|
1525
1522
  if with_scores
1526
1523
  if reply
1527
1524
  reply.each_slice(2).map do |member, score|
1528
- [member, Float(score)]
1525
+ [member, _floatify(score)]
1529
1526
  end
1530
1527
  end
1531
1528
  else
@@ -1553,17 +1550,17 @@ class Redis
1553
1550
  args = []
1554
1551
 
1555
1552
  with_scores = options[:with_scores] || options[:withscores]
1556
- args.concat ["WITHSCORES"] if with_scores
1553
+ args.concat(["WITHSCORES"]) if with_scores
1557
1554
 
1558
1555
  limit = options[:limit]
1559
- args.concat ["LIMIT", *limit] if limit
1556
+ args.concat(["LIMIT"] + limit) if limit
1560
1557
 
1561
1558
  synchronize do |client|
1562
- client.call [:zrevrangebyscore, key, max, min, *args] do |reply|
1559
+ client.call([:zrevrangebyscore, key, max, min] + args) do |reply|
1563
1560
  if with_scores
1564
1561
  if reply
1565
1562
  reply.each_slice(2).map do |member, score|
1566
- [member, Float(score)]
1563
+ [member, _floatify(score)]
1567
1564
  end
1568
1565
  end
1569
1566
  else
@@ -1592,7 +1589,7 @@ class Redis
1592
1589
  # @return [Fixnum] number of members that were removed
1593
1590
  def zremrangebyscore(key, min, max)
1594
1591
  synchronize do |client|
1595
- client.call [:zremrangebyscore, key, min, max]
1592
+ client.call([:zremrangebyscore, key, min, max])
1596
1593
  end
1597
1594
  end
1598
1595
 
@@ -1615,7 +1612,7 @@ class Redis
1615
1612
  # @return [Fixnum] number of members in within the specified range
1616
1613
  def zcount(key, min, max)
1617
1614
  synchronize do |client|
1618
- client.call [:zcount, key, min, max]
1615
+ client.call([:zcount, key, min, max])
1619
1616
  end
1620
1617
  end
1621
1618
 
@@ -1637,13 +1634,13 @@ class Redis
1637
1634
  args = []
1638
1635
 
1639
1636
  weights = options[:weights]
1640
- args.concat ["WEIGHTS", *weights] if weights
1637
+ args.concat(["WEIGHTS"] + weights) if weights
1641
1638
 
1642
1639
  aggregate = options[:aggregate]
1643
- args.concat ["AGGREGATE", aggregate] if aggregate
1640
+ args.concat(["AGGREGATE", aggregate]) if aggregate
1644
1641
 
1645
1642
  synchronize do |client|
1646
- client.call [:zinterstore, destination, keys.size, *(keys + args)]
1643
+ client.call([:zinterstore, destination, keys.size] + keys + args)
1647
1644
  end
1648
1645
  end
1649
1646
 
@@ -1664,13 +1661,13 @@ class Redis
1664
1661
  args = []
1665
1662
 
1666
1663
  weights = options[:weights]
1667
- args.concat ["WEIGHTS", *weights] if weights
1664
+ args.concat(["WEIGHTS"] + weights) if weights
1668
1665
 
1669
1666
  aggregate = options[:aggregate]
1670
- args.concat ["AGGREGATE", aggregate] if aggregate
1667
+ args.concat(["AGGREGATE", aggregate]) if aggregate
1671
1668
 
1672
1669
  synchronize do |client|
1673
- client.call [:zunionstore, destination, keys.size, *(keys + args)]
1670
+ client.call([:zunionstore, destination, keys.size] + keys + args)
1674
1671
  end
1675
1672
  end
1676
1673
 
@@ -1680,7 +1677,7 @@ class Redis
1680
1677
  # @return [Fixnum] number of fields in the hash
1681
1678
  def hlen(key)
1682
1679
  synchronize do |client|
1683
- client.call [:hlen, key]
1680
+ client.call([:hlen, key])
1684
1681
  end
1685
1682
  end
1686
1683
 
@@ -1692,7 +1689,7 @@ class Redis
1692
1689
  # @return [Boolean] whether or not the field was **added** to the hash
1693
1690
  def hset(key, field, value)
1694
1691
  synchronize do |client|
1695
- client.call [:hset, key, field, value], &_boolify
1692
+ client.call([:hset, key, field, value], &_boolify)
1696
1693
  end
1697
1694
  end
1698
1695
 
@@ -1704,7 +1701,7 @@ class Redis
1704
1701
  # @return [Boolean] whether or not the field was **added** to the hash
1705
1702
  def hsetnx(key, field, value)
1706
1703
  synchronize do |client|
1707
- client.call [:hsetnx, key, field, value], &_boolify
1704
+ client.call([:hsetnx, key, field, value], &_boolify)
1708
1705
  end
1709
1706
  end
1710
1707
 
@@ -1721,7 +1718,7 @@ class Redis
1721
1718
  # @see #mapped_hmset
1722
1719
  def hmset(key, *attrs)
1723
1720
  synchronize do |client|
1724
- client.call [:hmset, key, *attrs]
1721
+ client.call([:hmset, key] + attrs)
1725
1722
  end
1726
1723
  end
1727
1724
 
@@ -1737,7 +1734,7 @@ class Redis
1737
1734
  #
1738
1735
  # @see #hmset
1739
1736
  def mapped_hmset(key, hash)
1740
- hmset(key, *hash.to_a.flatten)
1737
+ hmset(key, hash.to_a.flatten)
1741
1738
  end
1742
1739
 
1743
1740
  # Get the value of a hash field.
@@ -1747,7 +1744,7 @@ class Redis
1747
1744
  # @return [String]
1748
1745
  def hget(key, field)
1749
1746
  synchronize do |client|
1750
- client.call [:hget, key, field]
1747
+ client.call([:hget, key, field])
1751
1748
  end
1752
1749
  end
1753
1750
 
@@ -1764,7 +1761,7 @@ class Redis
1764
1761
  # @see #mapped_hmget
1765
1762
  def hmget(key, *fields, &blk)
1766
1763
  synchronize do |client|
1767
- client.call [:hmget, key, *fields], &blk
1764
+ client.call([:hmget, key] + fields, &blk)
1768
1765
  end
1769
1766
  end
1770
1767
 
@@ -1782,11 +1779,7 @@ class Redis
1782
1779
  def mapped_hmget(key, *fields)
1783
1780
  hmget(key, *fields) do |reply|
1784
1781
  if reply.kind_of?(Array)
1785
- hash = Hash.new
1786
- fields.zip(reply).each do |field, value|
1787
- hash[field] = value
1788
- end
1789
- hash
1782
+ Hash[fields.zip(reply)]
1790
1783
  else
1791
1784
  reply
1792
1785
  end
@@ -1800,7 +1793,7 @@ class Redis
1800
1793
  # @return [Fixnum] the number of fields that were removed from the hash
1801
1794
  def hdel(key, field)
1802
1795
  synchronize do |client|
1803
- client.call [:hdel, key, field]
1796
+ client.call([:hdel, key, field])
1804
1797
  end
1805
1798
  end
1806
1799
 
@@ -1811,7 +1804,7 @@ class Redis
1811
1804
  # @return [Boolean] whether or not the field exists in the hash
1812
1805
  def hexists(key, field)
1813
1806
  synchronize do |client|
1814
- client.call [:hexists, key, field], &_boolify
1807
+ client.call([:hexists, key, field], &_boolify)
1815
1808
  end
1816
1809
  end
1817
1810
 
@@ -1823,7 +1816,7 @@ class Redis
1823
1816
  # @return [Fixnum] value of the field after incrementing it
1824
1817
  def hincrby(key, field, increment)
1825
1818
  synchronize do |client|
1826
- client.call [:hincrby, key, field, increment]
1819
+ client.call([:hincrby, key, field, increment])
1827
1820
  end
1828
1821
  end
1829
1822
 
@@ -1835,8 +1828,8 @@ class Redis
1835
1828
  # @return [Float] value of the field after incrementing it
1836
1829
  def hincrbyfloat(key, field, increment)
1837
1830
  synchronize do |client|
1838
- client.call [:hincrbyfloat, key, field, increment] do |reply|
1839
- Float(reply) if reply
1831
+ client.call([:hincrbyfloat, key, field, increment]) do |reply|
1832
+ _floatify(reply) if reply
1840
1833
  end
1841
1834
  end
1842
1835
  end
@@ -1847,7 +1840,7 @@ class Redis
1847
1840
  # @return [Array<String>]
1848
1841
  def hkeys(key)
1849
1842
  synchronize do |client|
1850
- client.call [:hkeys, key]
1843
+ client.call([:hkeys, key])
1851
1844
  end
1852
1845
  end
1853
1846
 
@@ -1857,7 +1850,7 @@ class Redis
1857
1850
  # @return [Array<String>]
1858
1851
  def hvals(key)
1859
1852
  synchronize do |client|
1860
- client.call [:hvals, key]
1853
+ client.call([:hvals, key])
1861
1854
  end
1862
1855
  end
1863
1856
 
@@ -1867,14 +1860,14 @@ class Redis
1867
1860
  # @return [Hash<String, String>]
1868
1861
  def hgetall(key)
1869
1862
  synchronize do |client|
1870
- client.call [:hgetall, key], &_hashify
1863
+ client.call([:hgetall, key], &_hashify)
1871
1864
  end
1872
1865
  end
1873
1866
 
1874
1867
  # Post a message to a channel.
1875
1868
  def publish(channel, message)
1876
1869
  synchronize do |client|
1877
- client.call [:publish, channel, message]
1870
+ client.call([:publish, channel, message])
1878
1871
  end
1879
1872
  end
1880
1873
 
@@ -1946,11 +1939,11 @@ class Redis
1946
1939
  # @see #multi
1947
1940
  def watch(*keys)
1948
1941
  synchronize do |client|
1949
- client.call [:watch, *keys]
1942
+ client.call([:watch] + keys)
1950
1943
 
1951
1944
  if block_given?
1952
1945
  begin
1953
- yield
1946
+ yield(self)
1954
1947
  rescue ConnectionError
1955
1948
  raise
1956
1949
  rescue StandardError
@@ -1969,7 +1962,7 @@ class Redis
1969
1962
  # @see #multi
1970
1963
  def unwatch
1971
1964
  synchronize do |client|
1972
- client.call [:unwatch]
1965
+ client.call([:unwatch])
1973
1966
  end
1974
1967
  end
1975
1968
 
@@ -2018,7 +2011,7 @@ class Redis
2018
2011
  def multi
2019
2012
  synchronize do |client|
2020
2013
  if !block_given?
2021
- client.call [:multi]
2014
+ client.call([:multi])
2022
2015
  else
2023
2016
  begin
2024
2017
  pipeline = Pipeline::Multi.new
@@ -2044,7 +2037,7 @@ class Redis
2044
2037
  # @see #discard
2045
2038
  def exec
2046
2039
  synchronize do |client|
2047
- client.call [:exec]
2040
+ client.call([:exec])
2048
2041
  end
2049
2042
  end
2050
2043
 
@@ -2058,7 +2051,7 @@ class Redis
2058
2051
  # @see #exec
2059
2052
  def discard
2060
2053
  synchronize do |client|
2061
- client.call [:discard]
2054
+ client.call([:discard])
2062
2055
  end
2063
2056
  end
2064
2057
 
@@ -2093,7 +2086,7 @@ class Redis
2093
2086
  synchronize do |client|
2094
2087
  arg = args.first
2095
2088
 
2096
- client.call [:script, :exists, arg] do |reply|
2089
+ client.call([:script, :exists, arg]) do |reply|
2097
2090
  reply = reply.map { |r| _boolify.call(r) }
2098
2091
 
2099
2092
  if arg.is_a?(Array)
@@ -2105,7 +2098,7 @@ class Redis
2105
2098
  end
2106
2099
  else
2107
2100
  synchronize do |client|
2108
- client.call [:script, subcommand] + args
2101
+ client.call([:script, subcommand] + args)
2109
2102
  end
2110
2103
  end
2111
2104
  end
@@ -2119,7 +2112,7 @@ class Redis
2119
2112
  argv = args.shift || options[:argv] || []
2120
2113
 
2121
2114
  synchronize do |client|
2122
- client.call [cmd, script, keys.length] + keys + argv
2115
+ client.call([cmd, script, keys.length] + keys + argv)
2123
2116
  end
2124
2117
  end
2125
2118
 
@@ -2187,7 +2180,7 @@ class Redis
2187
2180
 
2188
2181
  def method_missing(command, *args)
2189
2182
  synchronize do |client|
2190
- client.call [command, *args]
2183
+ client.call([command] + args)
2191
2184
  end
2192
2185
  end
2193
2186
 
@@ -2212,8 +2205,16 @@ private
2212
2205
  }
2213
2206
  end
2214
2207
 
2208
+ def _floatify(str)
2209
+ if (inf = str.match(/^(-)?inf/i))
2210
+ (inf[1] ? -1.0 : 1.0) / 0.0
2211
+ else
2212
+ Float str
2213
+ end
2214
+ end
2215
+
2215
2216
  def _subscription(method, channels, block)
2216
- return @client.call [method, *channels] if subscribed?
2217
+ return @client.call([method] + channels) if subscribed?
2217
2218
 
2218
2219
  begin
2219
2220
  original, @client = @client, SubscribedClient.new(@client)