Module: EasyCreds::Differ

Defined in:
lib/easy_creds/differ.rb

Defined Under Namespace

Classes: Change

Class Method Summary collapse

Class Method Details

.compare(local:, remote:) ⇒ Object

kind: :added (remote-only), :removed (local-only), :modified (differs) side: :local, :remote, :both



9
10
11
12
13
14
15
16
17
18
# File 'lib/easy_creds/differ.rb', line 9

def self.compare(local:, remote:)
  local_flat  = Flatten.dot(local)
  remote_flat = Flatten.dot(remote)
  all_keys    = (local_flat.keys | remote_flat.keys).sort

  all_keys.each_with_object([]) do |key, changes|
    change = classify_change(key, local_flat, remote_flat)
    changes << change if change
  end
end

.empty?(changes) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/easy_creds/differ.rb', line 37

def self.empty?(changes)
  changes.empty?
end