Module: ApiValidator::Mixins::DeepMerge
- Included in:
- ResponseExpectation::Results, Spec::Results
- Defined in:
- lib/api-validator/mixins/deep_merge.rb
Instance Method Summary collapse
Instance Method Details
#deep_merge!(hash, *others) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/api-validator/mixins/deep_merge.rb', line 5 def deep_merge!(hash, *others) others.each do |other| other.each_pair do |key, val| if hash.has_key?(key) next if hash[key] == val case val when Hash deep_merge!(hash[key], val) when Array hash[key].concat(val) when FalseClass # false always wins hash[key] = val end else hash[key] = val end end end end |