Class: Terrestrial::Cli::EntryCollectionDiffer

Inherits:
Object
  • Object
show all
Defined in:
lib/terrestrial/cli/entry_collection_differ.rb

Class Method Summary collapse

Class Method Details

.additions(first, second) ⇒ Object



11
12
13
14
15
# File 'lib/terrestrial/cli/entry_collection_differ.rb', line 11

def self.additions(first, second)
  second.reject do |b| 
    first.any? {|a| match?(a, b) }
  end
end

.match?(a, b) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/terrestrial/cli/entry_collection_differ.rb', line 17

def self.match?(a, b)
  a.fetch("identifier") == b.fetch("identifier")
end

.omissions(first, second) ⇒ Object



5
6
7
8
9
# File 'lib/terrestrial/cli/entry_collection_differ.rb', line 5

def self.omissions(first, second)
  first.select do |a|
    !second.any? {|b| match?(a, b)}
  end
end