Class: Array

Inherits:
Object show all
Defined in:
lib/omega/common.rb

Instance Method Summary collapse

Instance Method Details

#uniq_by(&blk) ⇒ Object


55
56
57
58
59
60
61
62
63
# File 'lib/omega/common.rb', line 55

def uniq_by(&blk)
  transforms = {}
  select do |el|
    t = blk[el]
    should_keep = !transforms[t]
    transforms[t] = true
    should_keep
  end
end