Posted By

nate63179 on 01/09/10


Tagged

ruby


Versions (?)

RUBY: Recursive symbolize keys


 / Published in: Ruby
 

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

  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  

You need to login to post a comment.