Skip to content

Instantly share code, notes, and snippets.

@Malet
Created August 23, 2015 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Malet/f13f69ba7fa84ed2b74a to your computer and use it in GitHub Desktop.
Save Malet/f13f69ba7fa84ed2b74a to your computer and use it in GitHub Desktop.
Hash Stringify Keys
class Hash
def stringify_keys
result = {}
each_key do |key|
result[key.to_s] = if self[key].class == Hash
self[key].stringify_keys
else
self[key]
end
end
result
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment