Module: RedfishTools::Utils
- Defined in:
- lib/redfish_tools/utils.rb
Class Method Summary collapse
Class Method Details
.combine_hashes(original, b, path: nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/redfish_tools/utils.rb', line 5 def self.combine_hashes(original, b, path: nil) path ||= [] a = original.clone b.each {|key, value| if a.include?(key) if (a[key].is_a? Hash) && (b[key].is_a? Hash) a[key] = combine_hashes(a[key], b[key], path: path + [key.to_s]) elsif a[key].is_a? b[key].class a[key] = b[key] else raise Exceptions::MergeConflict, "Conflict at '%s'" % (path + [key.to_s]).join(".") end else a[key] = value end } a end |