Class: Integer

Inherits:
Object
  • Object
show all
Defined in:
lib/progress/integer.rb

Overview

Add times_with_progress method to Integer

Instance Method Summary collapse

Instance Method Details

#times_with_progress(title = nil) ⇒ Object

run ‘times` with progress

100.times_with_progress('Numbers') do |number|
  # code
end


11
12
13
14
15
16
17
18
19
# File 'lib/progress/integer.rb', line 11

def times_with_progress(title = nil)
  Progress.start(title, self) do
    times do |i|
      Progress.step do
        yield i
      end
    end
  end
end