Given you have a Ruby Array like a = [1,2,3,2,4,4,2,5] how can you select elements that occurred multiple times in the given array ?
so return value == [2,4]
a.group_by(&:itself).select{|_, a| a[1]}.keys
a[1] is shorter, I'd use the more explicit a.length > 1. Nice side effect: it works for nil and false values.