/usr/lib/ruby/vendor_ruby/fog/core/stringify_keys.rb is in ruby-fog-core 1.45.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 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
|