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



44
45
46
47
48
49
50
51
# File 'lib/omnibus/manifest_diff.rb', line 44

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

#empty?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/omnibus/manifest_diff.rb', line 53

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

#removedObject



35
36
37
38
39
40
41
42
# File 'lib/omnibus/manifest_diff.rb', line 35

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

#updatedObject



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

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