Class: Filey::Comparison

Inherits:
Object
  • Object
show all
Defined in:
lib/filey-diff/comparison.rb

Class Method Summary collapse

Class Method Details

.list_changed(data_source_a, data_source_b) ⇒ Object



9
10
11
12
13
# File 'lib/filey-diff/comparison.rb', line 9

def self.list_changed(data_source_a, data_source_b)
  select_in_outer_array(data_source_b, data_source_a) { |b_item, a_item|
    !a_item.nil? && b_item.md5 != a_item.md5
  }
end

.list_missing(data_source_a, data_source_b) ⇒ Object



15
16
17
18
19
20
# File 'lib/filey-diff/comparison.rb', line 15

def self.list_missing(data_source_a, data_source_b)
  intersection = select_in_outer_array(data_source_a, data_source_b) { |a_item, b_item|
    !b_item.nil?
  }
  data_source_a.get_fileys - intersection
end

.list_outdated(data_source_a, data_source_b) ⇒ Object



3
4
5
6
7
# File 'lib/filey-diff/comparison.rb', line 3

def self.list_outdated(data_source_a, data_source_b)
  select_in_outer_array(data_source_b, data_source_a) { |b_item, a_item|
    !a_item.nil? && b_item.last_modified < a_item.last_modified
  }
end