Module: Enumerable

Defined in:
lib/es.rb

Overview

Hack for 1.8.7 uniq on array does not take block

Instance Method Summary collapse

Instance Method Details

#uniq_byObject



1073
1074
1075
1076
# File 'lib/es.rb', line 1073

def uniq_by
  seen = Hash.new { |h,k| h[k] = true; false }
  reject { |v| seen[yield(v)] }
end