piotrmurach/tty-progressbar

View on GitHub
examples/indeterminate.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

require_relative "../lib/tty-progressbar"

bar = TTY::ProgressBar.new("downloading [:bar] :current/:total :current_byte " \
                           ":total_byte :percent ET::elapsed ETA::eta " \
                           ":rate/s :mean_rate/s :byte_rate/s :mean_byte/s",
                           width: 40)

170.times do |i|
  sleep(0.05)
  bar.advance
  bar.update(total: 170) if i == 69
end