Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/pxcbackup/array.rb

Instance Method Summary collapse

Instance Method Details

#uniq_by(&blk) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/pxcbackup/array.rb', line 2

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