Sha256: b07ace431c12558ae48e3873ebde2060f2a28e1c67d7b27c1873695ced766a01
Contents?: true
Size: 618 Bytes
Versions: 1
Compression:
Stored size: 618 Bytes
Contents
module Basquiat module HashRefinements refine Hash do def deep_merge(other_hash) other_hash.each_pair do |key, value| current = self[key] if current.is_a?(Hash) && value.is_a?(Hash) current.deep_merge(value) else self[key] = value end end end def symbolize_keys each_with_object({}) do |(key, value), new_hash| new_key = key.to_sym rescue key new_value = (value.is_a? Hash) ? value.symbolize_keys : value new_hash[new_key] = new_value end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
basquiat-1.1.1 | lib/basquiat/support/hash_refinements.rb |