Class: Spider::DataTypes::TimeSpan
- Includes:
- Spider::DataType
- Defined in:
- lib/spiderfw/model/datatypes/time_span.rb
Instance Method Summary collapse
Methods included from Spider::DataType
#attributes, included, #map, #new, #prepare
Instance Method Details
#format(f = nil) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/spiderfw/model/datatypes/time_span.rb', line 9 def format(f=nil) if self % 3600 == 0 val = self / 3600 "#{val} " + (val == 1 ? _('hour') : _('hours') ) elsif self % 60 == 0 val = self / 60 "#{val} " + (val == 1 ? _('minute') : _('minutes') ) else val = self "#{val} " + (val == 1 ? _('second') : _('seconds') ) end end |