Sha256: 372ea83d0206363cdc07dd9cb11ec5495bcc294efaad2bf1751de84abc92d467
Contents?: true
Size: 404 Bytes
Versions: 3
Compression:
Stored size: 404 Bytes
Contents
class ProgressBar module WithProgress def each_with_progress(&block) bar = ProgressBar.new(count) if block each{|obj| yield(obj).tap{bar.increment!}} else Enumerator.new{|yielder| self.each do |obj| (yielder << obj).tap{bar.increment!} end } end end alias_method :with_progress, :each_with_progress end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
progress_bar-1.3.0 | lib/progress_bar/with_progress.rb |
progress_bar-1.2.0 | lib/progress_bar/with_progress.rb |
progress_bar-1.1.0 | lib/progress_bar/with_progress.rb |