Module: Enumerable
- Defined in:
- lib/rails_best_practices/core_ext/enumerable.rb
Instance Method Summary collapse
-
#dups ⇒ Enumerable
Get the duplicate entries from an Enumerable.
Instance Method Details
#dups ⇒ Enumerable
Get the duplicate entries from an Enumerable.
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 |