Class: Totals::DigitalFormatter

Inherits:
Object
  • Object
show all
Includes:
Formatter
Defined in:
lib/totals.rb

Instance Attribute Summary

Attributes included from Formatter

#seconds

Instance Method Summary collapse

Methods included from Formatter

#initialize

Instance Method Details

#formatObject


13
14
15
16
17
18
19
# File 'lib/totals.rb', line 13

def format
  hours   = seconds / 3600
  rest    = seconds - (hours * 3600)
  minutes = rest / 60

  "#{hours.left_pad}:#{minutes.left_pad}"
end