11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/click/database/models/snapshot.rb', line 11
def difference(earlier)
earlier_object_count_hash = Hash[earlier.object_counts_dataset.map([:class_name, :count])]
later_object_count_hash = Hash[object_counts_dataset.map([:class_name, :count])]
keys = Set.new(earlier_object_count_hash.keys + later_object_count_hash.keys)
diff = {}
keys.each do |key|
diff[key] = later_object_count_hash.fetch(key, 0) - earlier_object_count_hash.fetch(key, 0)
end
diff
end
|