ruby-1.9.1-p378 > [1, 2, 2, 3, 4, 4].commonality
=> {2=>[2, 2], 4=>[4, 4]}
ruby-1.9.1-p378 > ["foo", "bar", "a"].commonality { |str| str.length }
=> {3=>["foo", "bar"]}
The collision method mentionned in the doc doesn't seem to be an existing alias of commonality (could be interesting to add it though!).