module ProgressBar::WithProgress
Public Instance Methods
each_with_progress(*args) { |obj| ... }
click to toggle source
# File lib/progress_bar/with_progress.rb, line 5 def each_with_progress(*args, &block) bar = ProgressBar.new(count, *args) if block each{ |obj| yield(obj).tap{ bar.increment! } } else Enumerator.new{ |yielder| each do |obj| (yielder << obj).tap{ bar.increment! } end } end end
Also aliased as: with_progress