Created
December 7, 2013 00:40
-
-
Save ryansmith3136/7835702 to your computer and use it in GitHub Desktop.
Snake to camel
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 s2c(x) | |
| case x | |
| when Hash then Hash[*x.flatten(1).map{|x| s2s(x)}] | |
| when Array then x.map{|x| s2s(x)} | |
| when Symbol then String(x).camelcase | |
| else x | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment