Skip to content

Instantly share code, notes, and snippets.

@troystribling
Created January 11, 2012 20:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save troystribling/1596664 to your computer and use it in GitHub Desktop.
Save troystribling/1596664 to your computer and use it in GitHub Desktop.
Recursive symbolize_keys
def symbolize_keys!(thing)
case thing
when Array
thing.each{|v| symbolize_keys!(v)}
when Hash
thing.symbolize_keys!
thing.values.each{|v| symbolize_keys!(v)}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment