Created
December 5, 2018 06:22
-
-
Save frank184/c2094964c2dbb526a11b489b147adf88 to your computer and use it in GitHub Desktop.
Stringify Keys in Ruby
This file contains 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 self.stringify_keys(h) | |
h.is_a?(Hash) ? h.collect{|k,v| [k.to_s, stringify_keys(v)]}.to_h : h | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment