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


305
306
307
308
309
310
311
# File 'lib/shoes/setup.rb', line 305

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


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

def count
  @count
end

Instance Method Details

#doneObject


326
327
# File 'lib/shoes/setup.rb', line 326

def done
end

#fetch(filename, len) ⇒ Object


318
319
320
# File 'lib/shoes/setup.rb', line 318

def fetch(filename, len)
  @total = len
end

#update(len) ⇒ Object


322
323
324
# File 'lib/shoes/setup.rb', line 322

def update(len)
  @prog.fraction = len.to_f / @total.to_f
end

#updated(message) ⇒ Object


313
314
315
316
# File 'lib/shoes/setup.rb', line 313

def updated(message)
  @count += 1.0
  @prog.fraction = (@count / @total.to_f) * 0.5
end