github-changelog-generator/lib/github_changelog_generator/hash.rb
Olle Jonsson d8b34169a3 Linting
2016-09-29 23:09:04 +02:00

17 lines
437 B
Ruby

# frozen_string_literal: true
class Hash
def stringify_keys_deep!
new_hash = {}
keys.each do |k|
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
end
new_hash
end
end