Class: Usine::Utils
- Inherits:
-
Object
- Object
- Usine::Utils
- Defined in:
- lib/usine/utils.rb
Class Method Summary collapse
Class Method Details
.merge_hashes(a, b) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/usine/utils.rb', line 3 def self.merge_hashes(a, b) b.each_pair do |current_key, other_value| this_value = a[current_key] next if !this_value.nil? && !other_value.nil? && other_value.class != this_value.class a[current_key] = if this_value.is_a?(Hash) && other_value.is_a?(Hash) Usine::Utils.merge_hashes(this_value, other_value) else other_value end end a end |