i have following code.
for i in 0..sold.length-1 duplicate = sold[i] print duplicate.check_duplicates print \" \" print sold[i].lotnumber + \
The hash resulting from the group_by method can be used as a counting device; this does not use the check_duplicates method.
check_duplicates
grouped = sold.group_by{|item| [item.lotnumber, item.serialnumber]} grouped.each{|key, value| puts "#{value.size} #{key.first}\t#{key.last}"}