# frozen_string_literal: true Array.class_eval do # @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