Module: Plotlyjs::Utils

Defined in:
lib/plotlyjs/utils.rb

Class Method Summary collapse

Class Method Details

.deep_merge(hash_a, hash_b) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/plotlyjs/utils.rb', line 3

def self.deep_merge(hash_a, hash_b)
  hash_a = hash_a.dup
  hash_b.each_pair do |k, v|
    tv = hash_a[k]
    hash_a[k] = tv.is_a?(Hash) && v.is_a?(Hash) ? deep_merge(tv, v) : v
  end
  hash_a
end