Class: Gem::ShoesFace::DownloadReporter
- Inherits:
-
Object
- Object
- Gem::ShoesFace::DownloadReporter
- Defined in:
- lib/shoes/setup.rb
Overview
ProgressReporter
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
Instance Method Summary collapse
- #done ⇒ Object
- #fetch(filename, len) ⇒ Object
-
#initialize(prog, status, size, initial_message, terminal_message = "complete") ⇒ DownloadReporter
constructor
A new instance of DownloadReporter.
- #update(len) ⇒ Object
- #updated(message) ⇒ Object
Constructor Details
#initialize(prog, status, size, initial_message, terminal_message = "complete") ⇒ DownloadReporter
Returns a new instance of DownloadReporter.
306 307 308 309 310 311 312 |
# File 'lib/shoes/setup.rb', line 306 def initialize(prog, status, size, , = "complete") @prog = prog (@status = status).replace @total = size @count = 0.0 end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
304 305 306 |
# File 'lib/shoes/setup.rb', line 304 def count @count end |
Instance Method Details
#done ⇒ Object
327 328 |
# File 'lib/shoes/setup.rb', line 327 def done end |
#fetch(filename, len) ⇒ Object
319 320 321 |
# File 'lib/shoes/setup.rb', line 319 def fetch(filename, len) @total = len end |
#update(len) ⇒ Object
323 324 325 |
# File 'lib/shoes/setup.rb', line 323 def update(len) @prog.fraction = len.to_f / @total.to_f end |
#updated(message) ⇒ Object
314 315 316 317 |
# File 'lib/shoes/setup.rb', line 314 def updated() @count += 1.0 @prog.fraction = (@count / @total.to_f) * 0.5 end |