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
plaid-14.13.0 vendor/bundle/ruby/3.0.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
plaid-14.12.1 vendor/bundle/ruby/3.0.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
plaid-14.12.0 vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
plaid-14.11.1 vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
plaid-14.10.0 vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
plaid-14.7.0 vendor/bundle/ruby/2.6.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
passbase-1.3.0 vendor/bundle/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
passbase-1.2.0 vendor/bundle/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
passbase-1.1.0 vendor/bundle/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
passbase-1.0.3 vendor/bundle/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
passbase-1.0.2 vendor/bundle/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
passbase-1.0.1 vendor/bundle/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
passbase-1.0.0 vendor/bundle/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
paynow_sdk-1.1.0 vendor/bundle/ruby/2.7.0/gems/paynow_sdk-1.0.9/vendor/bundle/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
paynow_sdk-1.1.0 vendor/bundle/ruby/2.7.0/gems/paynow_sdk-1.0.9/vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
paynow_sdk-1.1.0 vendor/bundle/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
paynow_sdk-1.1.0 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
paynow_sdk-1.1.0 vendor/bundle/ruby/2.7.0/gems/paynow_sdk-1.0.9/vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
paynow_sdk-1.1.0 vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb
paynow_sdk-1.0.9 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/refinements/enumerator.rb