I have created a very ugly script to collect same numbers from an array. I don\'t think this is a very Ruby way :) Anyone could provide a more clean solution?
ar
just another oneliner
arr = [5, 5, 2, 2, 2, 6, 6] arr.uniq.map {|e| [e]*arr.count(e) } # => [[5, 5], [2, 2, 2], [6, 6]]