# File lib/active_support/core_ext/array/uniq_by.rb, line 6 def uniq_by hash, array = {}, [] each { |i| hash[yield(i)] ||= (array << i) } array end