Class: Gem::CobblerFace::DownloadReporter
- Inherits:
-
Object
- Object
- Gem::CobblerFace::DownloadReporter
- Defined in:
- lib/shoes/cobbler.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.
31 32 33 34 35 36 37 |
# File 'lib/shoes/cobbler.rb', line 31 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.
29 30 31 |
# File 'lib/shoes/cobbler.rb', line 29 def count @count end |
Instance Method Details
#done ⇒ Object
52 53 |
# File 'lib/shoes/cobbler.rb', line 52 def done end |
#fetch(filename, len) ⇒ Object
44 45 46 |
# File 'lib/shoes/cobbler.rb', line 44 def fetch(filename, len) @total = len end |
#update(len) ⇒ Object
48 49 50 |
# File 'lib/shoes/cobbler.rb', line 48 def update(len) @prog.fraction = len.to_f / @total.to_f end |
#updated(message) ⇒ Object
39 40 41 42 |
# File 'lib/shoes/cobbler.rb', line 39 def updated() @count += 1.0 @prog.fraction = (@count / @total.to_f) * 0.5 end |