Skip to content

Instantly share code, notes, and snippets.

@davidpp
Created April 10, 2013 16:22
Show Gist options
  • Select an option

  • Save davidpp/5356135 to your computer and use it in GitHub Desktop.

Select an option

Save davidpp/5356135 to your computer and use it in GitHub Desktop.
def symbolize_keys(hash)
hash.inject({}){|new_hash, key_value|
key, value = key_value
value = symbolize_keys(value) if value.is_a?(Hash)
new_hash[key.to_sym] = value
new_hash
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment