travis-web/waiter/lib/travis/utils/deep_merge.rb
Piotr Sarnacki 7c3ea5b7bc Fix subscribing to private channels
This was a combination of 2 bugs:

* we didn't do deep_merge on config in ruby app, so
  that any nested properties set in the javascript app would be
  overwritten
* channelPrefix was not properly set for Travis CI Pro
2015-02-25 11:43:19 +01:00

12 lines
385 B
Ruby

module Travis
module DeepMerge
def deep_merge(hash, other_hash)
hash.merge(other_hash) do |key, oldval, newval|
oldval = oldval.to_hash if oldval.respond_to?(:to_hash)
newval = newval.to_hash if newval.respond_to?(:to_hash)
oldval.class.to_s == 'Hash' && newval.class.to_s == 'Hash' ? deep_merge(oldval, newval) : newval
end
end
end
end