RUBY: Recursive symbolize keys


/ Published in: Ruby
Save to your folder(s)

Credit: http://pragmatig.wordpress.com/2009/04/14/recursive-symbolize_keys/


Copy this code and paste it in your HTML
  1. def recursive_symbolize_keys! hash
  2. hash.symbolize_keys!
  3. hash.values.select{|v| v.is_a? Hash}.each{|h| recursive_symbolize_keys!(h)}
  4. end

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.