Class: Itinerary::FindDupsTool
- Inherits:
-
Tool
- Object
- Tool
- Itinerary::FindDupsTool
show all
- Defined in:
- lib/itinerary/tools/find-dups.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Tool
find_tool, inherited, #initialize, tools
Class Method Details
.name ⇒ Object
4
5
6
|
# File 'lib/itinerary/tools/find-dups.rb', line 4
def self.name
'find-dups'
end
|
Instance Method Details
#parse(args) ⇒ Object
8
9
|
# File 'lib/itinerary/tools/find-dups.rb', line 8
def parse(args)
end
|
#run ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/itinerary/tools/find-dups.rb', line 11
def run
values = {}
@itinerary.entries.each do |rec|
%w{person organization email uri phone}.each do |key|
if (value = rec[key])
values[key] ||= {}
values[key][value] ||= []
values[key][value] << rec
end
end
end
values.each do |key, set|
set.each do |value, recs|
if recs.length > 1
puts
puts "#{key}: #{value}"
recs.each { |r| puts "\t" + r.path.to_s }
end
end
end
end
|