Sha256: 85dff703e3879784e495eb4ef668344b7dee1d5509f5b8e2f3fab9919044805b
Contents?: true
Size: 799 Bytes
Versions: 17
Compression:
Stored size: 799 Bytes
Contents
module Gem module Release module Helper module Hash MERGER = ->(key, lft, rgt) do if lft.is_a?(::Hash) && rgt.is_a?(::Hash) lft.merge(rgt, &MERGER) else rgt end end def deep_merge(hash, other) hash.merge(other, &MERGER) end def symbolize_keys(hash) hash.map do |key, obj| key = key.respond_to?(:to_sym) ? key.to_sym : key obj = symbolize_keys(obj) if obj.is_a?(::Hash) [key, obj] end.to_h end def only(hash, *keys) hash.select { |key, _| keys.include?(key) } end def except(hash, *keys) hash.reject { |key, _| keys.include?(key) } end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems