Method: Redis#hgetall

Defined in:
lib/redis.rb

#hgetall(key) ⇒ Hash<String, String>

Get all the fields and values in a hash.



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/redis.rb', line 253

def hgetall(key)
  synchronize do
    @client.call [:hgetall, key] do |reply|
      if reply.kind_of?(Array)
        hash = Hash.new
        reply.each_slice(2) do |field, value|
          hash[field] = value
        end
        hash
      else
        reply
      end
    end
  end
end