Class: Trialgemgue
- Inherits:
-
Object
- Object
- Trialgemgue
- Defined in:
- lib/aboutarray.rb
Class Method Summary collapse
Class Method Details
.all_duplicate(arr) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/aboutarray.rb', line 2 def self.all_duplicate(arr) raise 'Type Error' unless arr.instance_of? Array @arr = arr @arr.sort! report = [] duplicate_item_list = arr.uniq # [1,1,2] [1,2] duplicate_item_list.each do |candidate| duplicate_item_count = find_all_duplicate(candidate) next unless duplicate_item_count > 1 report << [candidate, duplicate_item_count] end return reporting(report) end |