Class: CalendariumRomanum::CLI::Comparator Private
- Inherits:
-
Object
- Object
- CalendariumRomanum::CLI::Comparator
- Includes:
- Helper
- Defined in:
- lib/calendarium-romanum/cli/comparator.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Compares two sanctorale data files, reports differences.
Instance Method Summary collapse
- #call(path_a, path_b) ⇒ Object private
Methods included from Helper
Instance Method Details
#call(path_a, path_b) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/calendarium-romanum/cli/comparator.rb', line 9 def call(path_a, path_b) paths = [path_a, path_b] sanctoralia = paths.collect {|source| sanctorale_from_path source } names = paths.collect {|source| File.basename source } all_possible_dates.each do |d| a, b = sanctoralia.collect {|sanctorale| sanctorale[d] } 0.upto([a.size, b.size].max - 1) do |i| ca = a[i] cb = b[i] compared = [ca, cb] if compared.index(&:nil?) notnili = compared.index {|c| !c.nil? } print date(d) puts " only in #{names[notnili]}:" puts celebration(compared[notnili]) puts next end differences = %i(rank colour symbol).select do |property| ca.public_send(property) != cb.public_send(property) end next if differences.empty? print date(d) puts " differs in #{differences.join(', ')}" puts celebration(ca) puts celebration(cb) puts end end end |