Sha256: 778040f16d5967193f7202b9477c313fded6af1a04a5d5bdfaec5efd0f6044e2
Contents?: true
Size: 543 Bytes
Versions: 38
Compression:
Stored size: 543 Bytes
Contents
class ProgressBar module Refinements module Enumerator refine ::Enumerator do # rubocop:disable Metrics/BlockNesting 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 # rubocop:enable Metrics/BlockNesting end end end end
Version data entries
38 entries across 38 versions & 5 rubygems