Sha256: 97427a0fe527ed131b56a6ee017eb090b57086f8f0679cc75df929141c1198ce
Contents?: true
Size: 830 Bytes
Versions: 24
Compression:
Stored size: 830 Bytes
Contents
module TablePrint module HashExtensions module ConstructiveMerge def constructive_merge(hash) target = dup hash.keys.each do |key| if hash[key].is_a? Hash and self[key].is_a? Hash target[key].extend ConstructiveMerge target[key] = target[key].constructive_merge(hash[key]) next end target[key] = hash[key] end target end def constructive_merge!(hash) target = self hash.keys.each do |key| if hash[key].is_a? Hash and self[key].is_a? Hash target[key].extend ConstructiveMerge target[key] = target[key].constructive_merge(hash[key]) next end target[key] = hash[key] end target end end end end
Version data entries
24 entries across 24 versions & 1 rubygems