Skip to content

Instantly share code, notes, and snippets.

@frank184
Created December 5, 2018 06:22
Show Gist options
  • Save frank184/c2094964c2dbb526a11b489b147adf88 to your computer and use it in GitHub Desktop.
Save frank184/c2094964c2dbb526a11b489b147adf88 to your computer and use it in GitHub Desktop.
Stringify Keys in Ruby
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