Class: ConsulWatcher::Diff

Inherits:
Object
  • Object
show all
Defined in:
lib/consul_watcher/diff.rb

Instance Method Summary collapse

Constructor Details

#initialize(parser_config) ⇒ Diff

Returns a new instance of Diff.



7
# File 'lib/consul_watcher/diff.rb', line 7

def initialize(parser_config) end

Instance Method Details

#parse(previous_watch_data, current_watch_data) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/consul_watcher/diff.rb', line 9

def parse(previous_watch_data, current_watch_data)
  diff = HashDiff.diff(sanitize_data(previous_watch_data), sanitize_data(current_watch_data), array_path: true)
  diff.each do |change|
    change[1] = change[1]&.join('/')
  end
  diff
end