Module: MoreCoreExtensions::ArrayDuplicates

Defined in:
lib/more_core_extensions/core_ext/array/duplicates.rb

Instance Method Summary collapse

Instance Method Details

#duplicatesObject

Returns an Array of the duplicates found.

[1, 2, 3, 4, 2, 4].duplicates  #=> [2, 4]


9
10
11
# File 'lib/more_core_extensions/core_ext/array/duplicates.rb', line 9

def duplicates
  element_counts.select { |_k, v| v > 1 }.keys
end