Sha256: 0c2cdeab8ca33d4112e1d0b803a85fc134d8f98b3d3bdbe4195e54881b34e545

Contents?: true

Size: 696 Bytes

Versions: 4

Compression:

Stored size: 696 Bytes

Contents

require 'enumerator'
require 'progress/with_progress'

module Enumerable
  # run any Enumerable method with progress
  # methods which don't necessarily go through all items (like find, any? or all?) will not show 100%
  # ==== Example
  #   [1, 2, 3].with_progress('Numbers').each do |number|
  #     # code
  #   end
  #
  #   [1, 2, 3].with_progress('Numbers').each_cons(2) do |numbers|
  #     # code
  #   end
  #
  #   (0...100).with_progress('Numbers').select do |numbers|
  #     # code
  #   end
  #
  #   (0...100).with_progress('Numbers').all? do |numbers|
  #     # code
  #   end
  def with_progress(title = nil, &block)
    Progress::WithProgress.new(self, title, &block)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
progress-2.2.0 lib/progress/enumerable.rb
progress-2.1.1 lib/progress/enumerable.rb
progress-2.1.0 lib/progress/enumerable.rb
progress-2.0.0 lib/progress/enumerable.rb