Skip to content

Instantly share code, notes, and snippets.

@ebot
Created June 29, 2011 20:05
Show Gist options
  • Select an option

  • Save ebot/1054804 to your computer and use it in GitHub Desktop.

Select an option

Save ebot/1054804 to your computer and use it in GitHub Desktop.
kickstart
# Initialize the var
dupe_docs = {}
# In your loop/routine
dupe_docs[doc_id] = [] if dupe_docs[doc_id].nil?
dupe_docs[doc_id] << encounter_number
# At the bottom, output the totals
puts "There were #{dupe_docs.count} duplicate documents:"
dupe_docs.each do |doc, encounters|
puts "#{doc} - #{encounters.count} encounters"
encounters.each { |encounter| puts " #{encounter}" }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment