Sha256: b922b8c780d76e473d1cad36bdf3246282b312c4493fb0aab58c78ee374df779
Contents?: true
Size: 367 Bytes
Versions: 9
Compression:
Stored size: 367 Bytes
Contents
# frozen_string_literal: true Array.class_eval do unless method_defined?(:find_dupes) # @param threshold [Integer] default 1 # # @return [Array] excluding items that appear more than `threshold` times # def find_dupes(threshold = 1) results = select { |item| count(item) > threshold } results.uniq! results end end end
Version data entries
9 entries across 9 versions & 1 rubygems