Sha256: 10043814fb8d9ea83491e8b2f0e203d4f3cd5369f1bbd80b6aec848d8cf51752
Contents?: true
Size: 500 Bytes
Versions: 25
Compression:
Stored size: 500 Bytes
Contents
module Fog module StringifyKeys # Returns a new hash with all keys converted to strings. def self.stringify(original_hash) transform_hash(original_hash) do |hash, key, value| hash[key.to_s] = value end end private # http://devblog.avdi.org/2009/11/20/hash-transforms-in-ruby/ def self.transform_hash(original, &block) original.reduce({}) do |result, (key, value)| block.call(result, key, value) result end end end end
Version data entries
25 entries across 22 versions & 2 rubygems