Returns a new hash with all keys converted to strings.
# File lib/fog/core/stringify_keys.rb, line 4 def self.stringify(hash) transform_hash(hash) do |hash, key, value| hash[key.to_s] = value end end
devblog.avdi.org/2009/11/20/hash-transforms-in-ruby/
# File lib/fog/core/stringify_keys.rb, line 13 def self.transform_hash(original, options = {}, &block) original.reduce({}) do |result, (key, value)| value = if options[:deep] && Hash === value transform_hash(value, options, &block) else value end block.call(result, key, value) result end end