Revision: 30267
Updated Code
at August 11, 2010 03:37 by viatropos
Updated Code
class Hash def recursively_symbolize_keys! self.symbolize_keys! self.values.each do |v| if v.is_a? Hash v.recursively_symbolize_keys! elsif v.is_a? Array v.recursively_symbolize_keys! end end self end end class Array def recursively_symbolize_keys! self.each do |item| if item.is_a? Hash item.recursively_symbolize_keys! elsif item.is_a? Array item.recursively_symbolize_keys! end end end end
Revision: 30266
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 11, 2010 03:34 by viatropos
Initial Code
class Hash def recursively_symbolize_keys! self.symbolize_keys! self.values.each do |v| if v.is_a? Hash v.recursively_symbolize_keys! elsif v.is_a? Array v.recursively_symbolize_keys! end end self end end class Array def recursively_symbolize_keys! self.each do |item| if item.is_a? Hash item.recursively_symbolize_keys! elsif item.is_a? Array item.recursively_symbolize_keys! end end end end
Initial URL
recursively-symbolize-keys-in-ruby
Initial Description
Initial Title
Recursively Symbolize Keys in Ruby
Initial Tags
ruby
Initial Language
Ruby