2016-05-20 06:46:13 +00:00
|
|
|
class Hash
|
|
|
|
def stringify_keys_deep!
|
|
|
|
new_hash = {}
|
|
|
|
keys.each do |k|
|
2016-05-25 19:46:47 +00:00
|
|
|
ks = k.respond_to?(:to_s) ? k.to_s : k
|
|
|
|
new_hash[ks] = if values_at(k).first.is_a?(Hash) || values_at(k).first.is_a?(Array)
|
|
|
|
values_at(k).first.send(:stringify_keys_deep!)
|
|
|
|
else
|
|
|
|
values_at(k).first
|
|
|
|
end
|
2016-05-20 06:46:13 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
new_hash
|
|
|
|
end
|
2016-05-25 19:46:47 +00:00
|
|
|
end
|