Skip to content

Instantly share code, notes, and snippets.

@tschmidt
Created September 9, 2009 15:22
Show Gist options
  • Save tschmidt/183799 to your computer and use it in GitHub Desktop.
Save tschmidt/183799 to your computer and use it in GitHub Desktop.
# Convert string keys to symbols for a hash
class Hash
def symbolize_keys
self.replace(self.inject({}) { |h,(k,v)| h[k.to_sym] = v; h })
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment