From 63ed8d72202956484fde1f5a1d0a33a124adad08 Mon Sep 17 00:00:00 2001 From: Ethan Date: Wed, 11 Dec 2024 10:18:29 -0800 Subject: [PATCH] ProgressBar::WithProgress use #size when available --- lib/progress_bar/with_progress.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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