# File multiset/multiset.rb, line 546 def classify_with ret = Hash.new{ |hash, key| hash[key] = Multiset.new } self.each_pair do |item, count| ret[yield(item, count)].add(item, count) end ret end