Class: Omnibus::ManifestDiff

Inherits:
Object
  • Object
show all
Defined in:
lib/omnibus/manifest_diff.rb

Instance Method Summary collapse

Constructor Details

#initialize(first, second) ⇒ ManifestDiff

Returns a new instance of ManifestDiff.



21
22
23
24
# File 'lib/omnibus/manifest_diff.rb', line 21

def initialize(first, second)
  @first = first
  @second = second
end

Instance Method Details

#addedObject



40
41
42
43
44
45
# File 'lib/omnibus/manifest_diff.rb', line 40

def added
  @added ||=
    (second.entry_names - first.entry_names).collect do |name|
      new_entry(second.entry_for(name))
    end
end

#empty?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/omnibus/manifest_diff.rb', line 47

def empty?
  updated.empty? && removed.empty? && added.empty?
end

#removedObject



33
34
35
36
37
38
# File 'lib/omnibus/manifest_diff.rb', line 33

def removed
  @removed ||=
    (first.entry_names - second.entry_names).collect do |name|
      removed_entry(first.entry_for(name))
    end
end

#updatedObject



26
27
28
29
30
31
# File 'lib/omnibus/manifest_diff.rb', line 26

def updated
  @updated ||=
    (first.entry_names & second.entry_names).collect do |name|
      diff(first.entry_for(name), second.entry_for(name))
    end.compact
end