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

Version Path
ruby-rails-extensions-1.1.1 lib/ruby-rails-extensions/extensions/find_dupes.rb
ruby-rails-extensions-1.1.1.pre.rc.1 lib/ruby-rails-extensions/extensions/find_dupes.rb
ruby-rails-extensions-0.2.0 lib/ruby-rails-extensions/extensions/find_dupes.rb
ruby-rails-extensions-0.2.0.pre.rc.1 lib/ruby-rails-extensions/extensions/find_dupes.rb
ruby-rails-extensions-1.1.0 lib/ruby-rails-extensions/extensions/find_dupes.rb
ruby-rails-extensions-1.1.0.pre.rc.1 lib/ruby-rails-extensions/extensions/find_dupes.rb
ruby-rails-extensions-0.1.0 lib/ruby-rails-extensions/extensions/find_dupes.rb
ruby-rails-extensions-1.0.0 lib/ruby-rails-extensions/extensions/find_dupes.rb
ruby-rails-extensions-1.0.0.pre.rc.1 lib/ruby-rails-extensions/extensions/find_dupes.rb