Destructively convert all keys which respond_to?(:to_sym) to symbols. Works recursively if given nested hashes.
# File lib/caricature/core_ext/hash.rb, line 4 4: def symbolize_keys! 5: each do |k,v| 6: sym = k.respond_to?(:to_sym) ? k.to_sym : k 7: self[sym] = Hash === v ? v.symbolize_keys! : v 8: delete(k) unless k == sym 9: end 10: self 11: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.