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

Version Path
kinetic_sdk-5.0.2.beta.2 gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/refinements/enumerator.rb
kinetic_sdk-5.0.2.beta.1 gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/refinements/enumerator.rb
kinetic_sdk-5.0.1 gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/refinements/enumerator.rb
kinetic_sdk-5.0.0 gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/refinements/enumerator.rb
kinetic_sdk-1.0.2 gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/refinements/enumerator.rb
kinetic_sdk-1.0.1 gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/refinements/enumerator.rb
kinetic_sdk-1.0.0 gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/refinements/enumerator.rb
kinetic_sdk-0.1.1 gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/refinements/enumerator.rb
dirwatch-0.0.9 vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/refinements/enumerator.rb
dirwatch-0.0.8 vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/refinements/enumerator.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/refinements/enumerator.rb
dirwatch-0.0.6 vendor/bundle/ruby/2.3.0/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/refinements/enumerator.rb
dirwatch-0.0.5 vendor/bundle/ruby/2.3.0/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/refinements/enumerator.rb
dirwatch-0.0.4 vendor/bundle/ruby/2.3.0/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/refinements/enumerator.rb
dirwatch-0.0.3 vendor/bundle/ruby/2.3.0/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/refinements/enumerator.rb
dirwatch-0.0.2 vendor/bundle/ruby/2.3.0/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/refinements/enumerator.rb
progressbar-1.9.0 lib/ruby-progressbar/refinements/enumerator.rb
ruby-progressbar-1.9.0 lib/ruby-progressbar/refinements/enumerator.rb