Module: Enumerable

Defined in:
lib/exeach.rb

Instance Method Summary collapse

Instance Method Details

#verbose_eachObject



16
17
18
19
20
# File 'lib/exeach.rb', line 16

def verbose_each
  verbose_each_with_index do |ele, i|
    yield(ele)
  end
end

#verbose_each_with_indexObject



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/exeach.rb', line 3

def verbose_each_with_index
  siz = self.size
  cnt = 10
  if(siz > 200)
    cnt = 100
  end
  self.each_with_index do |ele, i|
    if(i%cnt == 0)
      p "#{i+1}/#{siz}"
    end
    yield(ele, i)
  end
end