lib/rmega/utils.rb in rmega-0.0.5 vs lib/rmega/utils.rb in rmega-0.0.6

- old
+ new

@@ -2,10 +2,13 @@ module Utils extend self def show_progress direction, total, increment = 0 return unless Rmega.options.show_progress - @progressbar_progress = 0 if increment.zero? + if increment.zero? + @progressbar = nil + @progressbar_progress = 0 + end @progressbar_progress += increment format = "#{direction.to_s.capitalize} in progress #{Utils.format_bytes(@progressbar_progress)} of #{Utils.format_bytes(total)} | %P% | %e " @progressbar ||= ProgressBar.create format: format, total: total @progressbar.reset if increment.zero? @progressbar.format format