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.



19
20
21
22
# File 'lib/lhm/printer.rb', line 19

def initialize
  super
  @max_length = 0
end

Instance Method Details

#endObject



30
31
32
33
# File 'lib/lhm/printer.rb', line 30

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

#notify(lowest, highest) ⇒ Object



24
25
26
27
28
# File 'lib/lhm/printer.rb', line 24

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