Module: Enumerable

Defined in:
lib/rails_best_practices/core_ext/enumerable.rb

Instance Method Summary collapse

Instance Method Details

#dupsEnumerable

Get the duplicate entries from an Enumerable.

Returns:



6
7
8
# File 'lib/rails_best_practices/core_ext/enumerable.rb', line 6

def dups
  inject({}) {|h,v| h[v]=h[v].to_i+1; h}.reject{|k,v| v==1}.keys
end