Skip to content

Commit

Permalink
Change to stop making copies
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmurach committed Jul 11, 2020
1 parent 83dfc3f commit e7b29f6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/tty/progressbar/multi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def start
# @api public
def total
synchronize do
(@bars - [@top_bar]).dup.map(&:total).reduce(&:+)
(@bars - [@top_bar]).map(&:total).reduce(&:+)
end
end

Expand All @@ -151,7 +151,7 @@ def total
# @api public
def current
synchronize do
(@bars - [@top_bar]).dup.map(&:current).reduce(&:+)
(@bars - [@top_bar]).map(&:current).reduce(&:+)
end
end

Expand All @@ -162,7 +162,7 @@ def current
# @api public
def complete?
synchronize do
(@bars - [@top_bar]).dup.all?(&:complete?)
(@bars - [@top_bar]).all?(&:complete?)
end
end

Expand All @@ -184,22 +184,22 @@ def stopped?
# @api public
def done?
synchronize do
(@bars - [@top_bar]).dup.all?(&:done?)
(@bars - [@top_bar]).all?(&:done?)
end
end

# Stop all progress bars
#
# @api public
def stop
@bars.dup.each(&:stop)
@bars.each(&:stop)
end

# Finish all progress bars
#
# @api public
def finish
@bars.dup.each(&:finish)
@bars.each(&:finish)
end

# Find the number of characters to move into the line
Expand Down

0 comments on commit e7b29f6

Please sign in to comment.