Sha256: e75dae116ffd8ea017f530950349aa1d7a7828c0d95f48194b15253065a4504e
Contents?: true
Size: 718 Bytes
Versions: 5
Compression:
Stored size: 718 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, length = nil, &block) Progress::WithProgress.new(self, title, length, &block) end end
Version data entries
5 entries across 5 versions & 1 rubygems