Skip to content

Instantly share code, notes, and snippets.

@moret
Last active August 29, 2015 13:58
Show Gist options
  • Select an option

  • Save moret/9960501 to your computer and use it in GitHub Desktop.

Select an option

Save moret/9960501 to your computer and use it in GitHub Desktop.
def symbolize obj
if obj.is_a? Hash
new_hash = {}
obj.each { |key, value| new_hash[key.to_sym] = symbolize value }
new_hash
elsif obj.is_a? Enumerable
obj.collect { |value| symbolize value }
else
obj
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment