Class: Gem::ShoesFace::DownloadReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/shoes/setup.rb

Overview

ProgressReporter

Instance Attribute Summary collapse

Instance Method Summary collapse

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, initial_message,
               terminal_message = "complete")
  @prog = prog
  (@status = status).replace initial_message
  @total = size
  @count = 0.0
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



304
305
306
# File 'lib/shoes/setup.rb', line 304

def count
  @count
end

Instance Method Details

#doneObject



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(message)
  @count += 1.0
  @prog.fraction = (@count / @total.to_f) * 0.5
end