mperham/sidekiq — pull request #1364 by kevinzen (2013-11-25 16:58:15+00:00)
Title: make 'redis=' work the same way for Hash and ConnectionPool

I've simplified this method and made processing consistent for ConnectionPool and Hash parameters passed in.

The following block of code allows `@redis` to be changed when passing a `ConnectionPool`:

```
def self.redis=(hash)
return @redis = hash if hash.is_a?(ConnectionPool)

if hash.is_a?(Hash)
@hash = hash
else
raise ArgumentError, "redis= requires a Hash or ConnectionPool"
end
end
```

If a hash is passed, `@redis` is not changed and the hash is saved. So calling `self.redis=(hash)` has different behavior depending on if it's called with a `Hash` or a `ConnectionPool`.

The new code in this pull request simplified the methods and ensures processing is the same for both Hash and ConnectionPool:

```
def self.redis=(hash)
return @redis = hash if hash.is_a?(ConnectionPool)
return @redis = Sidekiq::RedisConnection.create(@hash = hash) if hash.is_a?(Hash)
raise ArgumentError, "redis= requires a Hash or ConnectionPool"
end
```