class Kredis::Types::Hash
Attributes
typed[RW]
Public Instance Methods
[](key)
click to toggle source
# File lib/kredis/types/hash.rb, line 8 def [](key) string_to_type(hget(key), typed) end
[]=(key, value)
click to toggle source
# File lib/kredis/types/hash.rb, line 12 def []=(key, value) update key => value end
delete(*keys)
click to toggle source
# File lib/kredis/types/hash.rb, line 24 def delete(*keys) hdel keys if keys.flatten.any? end
entries()
click to toggle source
# File lib/kredis/types/hash.rb, line 32 def entries (hgetall || {}).transform_values { |val| string_to_type(val, typed) }.with_indifferent_access end
Also aliased as: to_h
keys()
click to toggle source
# File lib/kredis/types/hash.rb, line 37 def keys hkeys || [] end
remove()
click to toggle source
# File lib/kredis/types/hash.rb, line 28 def remove del end
update(**entries)
click to toggle source
# File lib/kredis/types/hash.rb, line 16 def update(**entries) hset entries.transform_values{ |val| type_to_string(val, typed) } if entries.flatten.any? end
values()
click to toggle source
# File lib/kredis/types/hash.rb, line 41 def values strings_to_types(hvals || [], typed) end
values_at(*keys)
click to toggle source
# File lib/kredis/types/hash.rb, line 20 def values_at(*keys) strings_to_types(hmget(keys) || [], typed) end