Class: Fontist::Utils::ProgressBar
- Inherits:
-
Object
- Object
- Fontist::Utils::ProgressBar
- Defined in:
- lib/fontist/utils/downloader.rb
Direct Known Subclasses
Instance Method Summary collapse
- #finish ⇒ Object
- #increment(progress) ⇒ Object
-
#initialize(total) ⇒ ProgressBar
constructor
A new instance of ProgressBar.
- #total=(total) ⇒ Object
Constructor Details
#initialize(total) ⇒ ProgressBar
Returns a new instance of ProgressBar.
199 200 201 202 203 204 205 |
# File 'lib/fontist/utils/downloader.rb', line 199 def initialize(total) @counter = 0 @total = total @printed_percent = -1 @printed_size = -1 @start = Time.now end |
Instance Method Details
#finish ⇒ Object
217 218 219 220 221 222 |
# File 'lib/fontist/utils/downloader.rb', line 217 def finish print Fontist.ui.print(format(", %<mb_per_second>.2f MiB/s, done.\n", mb_per_second: mb_per_second)) end |
#increment(progress) ⇒ Object
211 212 213 214 215 |
# File 'lib/fontist/utils/downloader.rb', line 211 def increment(progress) @counter = progress print_incrementally end |
#total=(total) ⇒ Object
207 208 209 |
# File 'lib/fontist/utils/downloader.rb', line 207 def total=(total) @total = total end |