class MacAppSync::Defaults::Comparator
Public Class Methods
different?(a, b)
click to toggle source
# File lib/mac_app_sync/defaults/comparator.rb, line 5 def different?(a, b) different_type?(a, b) || different_value?(a, b) end
Private Class Methods
different_hash_values?(a, b)
click to toggle source
# File lib/mac_app_sync/defaults/comparator.rb, line 37 def different_hash_values?(a, b) a.any? { |a_key, a_item| different?(a_item, b[a_key]) } end
different_items?(a, b)
click to toggle source
# File lib/mac_app_sync/defaults/comparator.rb, line 31 def different_items?(a, b) a.any? do |a_item| b.all? { |b_item| different?(a_item, b_item) } end end
different_size?(a, b)
click to toggle source
# File lib/mac_app_sync/defaults/comparator.rb, line 27 def different_size?(a, b) a.size != b.size end
different_type?(a, b)
click to toggle source
# File lib/mac_app_sync/defaults/comparator.rb, line 11 def different_type?(a, b) a.class != b.class end
different_value?(a, b)
click to toggle source
# File lib/mac_app_sync/defaults/comparator.rb, line 15 def different_value?(a, b) if a.is_a?(CFPropertyList::CFDictionary) different_size?(a.value, b.value) || different_hash_values?(a.value, b.value) elsif a.is_a?(CFPropertyList::CFArray) different_size?(a.value, b.value) || different_items?(a.value, b.value) else a.value != b.value end end