lib/hieracles/utils.rb in hieracles-0.3.0 vs lib/hieracles/utils.rb in hieracles-0.3.1

- old
+ new

@@ -27,9 +27,14 @@ def local_merge!(hash1, hash2) merger = proc { |key, v1, v2| v1.is_a?(Hash) && v2.is_a?(Hash) ? v1.merge(v2, &merger) : v2 } hash1.merge!(hash2, &merger) end + def local_merge(hash1, hash2) + merger = proc { |key, v1, v2| v1.is_a?(Hash) && v2.is_a?(Hash) ? v1.merge(v2, &merger) : v2 } + hash1.merge(hash2, &merger) + end + def deep_sort(object) if object.is_a?(Hash) res = {} object.each { |k, v| res[k] = deep_sort(v) } Hash[res.sort { |a, b| a[0].to_s <=> b[0].to_s }]