File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -24,14 +24,15 @@ module Resque
2424 extend self
2525
2626 # Accepts:
27- # 1. A 'hostname:port' string
28- # 2. A 'hostname:port:db' string (to select the Redis db)
29- # 3. A 'hostname:port/namespace' string (to set the Redis namespace)
30- # 4. A redis URL string 'redis://host:port'
27+ # 1. A 'hostname:port' String
28+ # 2. A 'hostname:port:db' String (to select the Redis db)
29+ # 3. A 'hostname:port/namespace' String (to set the Redis namespace)
30+ # 4. A Redis URL String 'redis://host:port'
3131 # 5. An instance of `Redis`, `Redis::Client`, `Redis::DistRedis`,
3232 # or `Redis::Namespace`.
3333 def redis = ( server )
34- if server . respond_to? :split
34+ case server
35+ when String
3536 if server =~ /redis\: \/ \/ /
3637 redis = Redis . connect ( :url => server , :thread_safe => true )
3738 else
@@ -43,8 +44,8 @@ def redis=(server)
4344 namespace ||= :resque
4445
4546 @redis = Redis ::Namespace . new ( namespace , :redis => redis )
46- elsif server . respond_to? :namespace=
47- @redis = server
47+ when Redis :: Namespace
48+ @redis = server
4849 else
4950 @redis = Redis ::Namespace . new ( :resque , :redis => server )
5051 end
You can’t perform that action at this time.
0 commit comments