Sha256: 60dd285b46420bc0bf23cff73568e24fa0fea574515ff7cfd91bde23196fb571
Contents?: true
Size: 763 Bytes
Versions: 10
Compression:
Stored size: 763 Bytes
Contents
require 'enumerator' require 'progress/with_progress' # Add with_progress method to Enumerable 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, length = nil, &block) Progress::WithProgress.new(self, title, length, &block) end end
Version data entries
10 entries across 10 versions & 1 rubygems