Sha256: c54f7870b37198ce4ce99f5f4895536cd6f327557baeef8893da32a5482d9b11
Contents?: true
Size: 625 Bytes
Versions: 16
Compression:
Stored size: 625 Bytes
Contents
# encoding: utf-8 module Hyperdrive module Utils def self.sanitize_keys(keys_to_keep, hash) Hash[hash.select do |key, value| keys_to_keep.include? key end] end def self.symbolize_keys(hash) hash.inject({}) do |result, (key, value)| result.merge!(Hash[ case key when String then key.to_sym else key end, case value when Hash then symbolize_keys(value) when Array then value.map! { |v| v.is_a?(Hash) ? symbolize_keys(v) : v } ; value else value end ]) end end end end
Version data entries
16 entries across 16 versions & 1 rubygems