Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make `_hashify` more similar to `_boolify`.

  • Loading branch information...
commit 137fe5437ec5eae47cf0085573948c018fd699cc 1 parent 9432aea
Damian Janowski djanowski authored
Showing with 9 additions and 13 deletions.
  1. +9 −13 lib/redis.rb
22 lib/redis.rb
View
@@ -252,13 +252,7 @@ def strlen(key)
# @return [Hash<String, String>]
def hgetall(key)
synchronize do
- @client.call [:hgetall, key] do |reply|
- if reply.kind_of?(Array)
- _hashify(reply)
- else
- reply
- end
- end
+ @client.call [:hgetall, key], &_hashify
end
end
@@ -1954,12 +1948,14 @@ def _boolify
}
end
- def _hashify(array)
- hash = Hash.new
- array.each_slice(2) do |field, value|
- hash[field] = value
- end
- hash
+ def _hashify
+ lambda { |array|
+ hash = Hash.new
+ array.each_slice(2) do |field, value|
+ hash[field] = value
+ end
+ hash
+ }
end
def subscription(method, channels, block)
Please sign in to comment.
Something went wrong with that request. Please try again.