Sha256: bdeb381afd8a1a43663542b2bef17c272de2f0841c3226aea9047d7207d26466
Contents?: true
Size: 370 Bytes
Versions: 18
Compression:
Stored size: 370 Bytes
Contents
require 'more_core_extensions/core_ext/array/element_counts' module MoreCoreExtensions module ArrayDuplicates # # Returns an Array of the duplicates found. # # [1, 2, 3, 4, 2, 4].duplicates #=> [2, 4] def duplicates element_counts.select { |_k, v| v > 1 }.keys end end end Array.send(:include, MoreCoreExtensions::ArrayDuplicates)
Version data entries
18 entries across 18 versions & 1 rubygems