Class: ForemanNetbox::NetboxParametersComparator

Inherits:
Object
  • Object
show all
Defined in:
app/services/foreman_netbox/netbox_parameters_comparator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(old_hash, new_hash) ⇒ NetboxParametersComparator

Returns a new instance of NetboxParametersComparator.



9
10
11
12
# File 'app/services/foreman_netbox/netbox_parameters_comparator.rb', line 9

def initialize(old_hash, new_hash)
  @old_hash = old_hash
  @new_hash = new_hash
end

Instance Attribute Details

#new_hashObject (readonly)

Returns the value of attribute new_hash.



20
21
22
# File 'app/services/foreman_netbox/netbox_parameters_comparator.rb', line 20

def new_hash
  @new_hash
end

#old_hashObject (readonly)

Returns the value of attribute old_hash.



20
21
22
# File 'app/services/foreman_netbox/netbox_parameters_comparator.rb', line 20

def old_hash
  @old_hash
end

Class Method Details

.call(old_hash, new_hash) ⇒ Object



5
6
7
# File 'app/services/foreman_netbox/netbox_parameters_comparator.rb', line 5

def self.call(old_hash, new_hash)
  new(old_hash, new_hash).call
end

Instance Method Details

#callObject



14
15
16
17
18
# File 'app/services/foreman_netbox/netbox_parameters_comparator.rb', line 14

def call
  keys_diff.deep_merge(diff_old)
           .deep_merge(diff_new)
           .compact
end