Module: Etcenv::Utils

Defined in:
lib/etcenv/utils.rb

Class Method Summary collapse

Class Method Details

.uniq_with_keeping_first_appearance(array) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/etcenv/utils.rb', line 4

def uniq_with_keeping_first_appearance(array)
  set = {}
  result = []
  array.each do |x|
    next if set[x]
    result.push x
    set[x] = true
  end
  result
end