Sha256: 0092e0d86b563f5564dd0acd2f3492788a994a31b14fd79d7f66804ee123575e
Contents?: true
Size: 462 Bytes
Versions: 118
Compression:
Stored size: 462 Bytes
Contents
class ProgressBar module Refinements module Enumerator refine ::Enumerator do def with_progressbar(options = {}, &block) chain = ::Enumerator.new do |yielder| progress_bar = ProgressBar.create(options.merge(:starting_at => 0, :total => size)) each do |*args| yielder.yield(*args).tap do progress_bar.increment end end end return chain unless block_given? chain.each(&block) end end end end end
Version data entries
118 entries across 72 versions & 21 rubygems