Created
January 11, 2012 20:43
-
-
Save troystribling/1596664 to your computer and use it in GitHub Desktop.
Recursive symbolize_keys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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