Class: Lhm::Printer::Percentage

Inherits:
Base
  • Object
show all
Defined in:
lib/lhm/printer.rb

Instance Method Summary collapse

Constructor Details

#initializePercentage

Returns a new instance of Percentage.



16
17
18
19
# File 'lib/lhm/printer.rb', line 16

def initialize
  super
  @max_length = 0
end

Instance Method Details

#endObject



27
28
29
30
# File 'lib/lhm/printer.rb', line 27

def end
  write('100% complete')
  @output.write "\n"
end

#notify(lowest, highest) ⇒ Object



21
22
23
24
25
# File 'lib/lhm/printer.rb', line 21

def notify(lowest, highest)
  return if !highest || highest == 0
  message = "%.2f%% (#{lowest}/#{highest}) complete" % (lowest.to_f / highest * 100.0)
  write(message)
end