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



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

def self.list_changed(data_source_a, data_source_b)
  select_in_outer_array(data_source_b, data_source_a) { |b_item, a_item|
    b_item.full_path == a_item.full_path and
      b_item.md5 != a_item.md5
  }
end

.list_missing(data_source_a, data_source_b) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/filey-diff/comparison.rb', line 17

def self.list_missing(data_source_a, data_source_b)
  intersection = select_in_outer_array(data_source_a, data_source_b) do
    |a_item, b_item|
    b_item.full_path == a_item.full_path
  end
  data_source_a.get_fileys - intersection
end

.list_outdated(data_source_a, data_source_b) ⇒ Object



3
4
5
6
7
8
# 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|
    b_item.full_path == a_item.full_path and
      b_item.last_modified < a_item.last_modified
  }
end