lib/looksist/hashed.rb in looksist-0.3.9 vs lib/looksist/hashed.rb in looksist-0.3.10
- old
+ new
@@ -61,11 +61,15 @@
keys = hash_offset[opt[:using]]
entity_name = __entity__(opt[:bucket_name] || opt[:using])
values = Looksist.redis_service.send("#{entity_name}_for", keys)
if opt[:populate].is_a? Array
opt[:populate].each do |elt|
- value_hash = values.each_with_object([]) do |i, acc|
- acc << JSON.parse(i || '{}').deep_symbolize_keys[elt]
+ if values.is_a?(Array)
+ value_hash = values.each_with_object([]) do |i, acc|
+ acc << JSON.parse(i || '{}').deep_symbolize_keys[elt]
+ end
+ else
+ value_hash = JSON.parse(values || '{}').deep_symbolize_keys[elt]
end
alias_method = find_alias(opt[:as], elt)
hash_offset[alias_method] = value_hash
end
else