diff --git a/lib/progress_bar/with_progress.rb b/lib/progress_bar/with_progress.rb index a0a8ab8..10fe54c 100644 --- a/lib/progress_bar/with_progress.rb +++ b/lib/progress_bar/with_progress.rb @@ -3,7 +3,7 @@ class ProgressBar module WithProgress def each_with_progress(*args, &block) - bar = ProgressBar.new(count, *args) + bar = ProgressBar.new(respond_to?(:size) && size || count, *args) if block each{ |obj| yield(obj).tap{ bar.increment! } } else