Class: Drumknott::Outputs::ProgressBar

Inherits:
Silent
  • Object
show all
Defined in:
lib/drumknott/outputs/progress_bar.rb

Instance Method Summary collapse

Methods inherited from Silent

call, #initialize

Constructor Details

This class inherits a constructor from Drumknott::Outputs::Silent

Instance Method Details

#call(label, collection) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/drumknott/outputs/progress_bar.rb', line 4

def call(label, collection)
  bar = ::ProgressBar.create :title => label, :total => collection.length

  collection.each do |item|
    block.call item
    bar.increment
  end
end