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

Version Path
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
dadapush_client-1.0.1 vendor/bundle/ruby/2.3.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
zuora_connect_ui-0.7.1 vendor/ruby/2.6.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
zuora_connect_ui-0.7.0 vendor/ruby/2.6.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
progressbar-1.10.1 lib/ruby-progressbar/refinements/enumerator.rb
ruby-progressbar-1.10.1 lib/ruby-progressbar/refinements/enumerator.rb
cspeezy_palindrome-0.3.0 path/ruby/2.6.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/refinements/enumerator.rb
cspeezy_palindrome-0.2.0 path/ruby/2.6.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/refinements/enumerator.rb
cspeezy_palindrome-0.1.0 path/ruby/2.6.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/refinements/enumerator.rb
steenfest_palindrome-0.1.2 ruby/2.5/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/refinements/enumerator.rb
steenfest_palindrome-0.1.1b ruby/2.5/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/refinements/enumerator.rb
nullifyable-0.1.0 vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/refinements/enumerator.rb