Class: PopCap::Formatters::Duration
- Defined in:
- lib/pop_cap/formatters/duration.rb
Overview
Public: This will format a duration tag as strftime.
time - Provide a string, float, or integer.
Instance Attribute Summary
Attributes inherited from Formatter
Instance Method Summary collapse
-
#format ⇒ Object
Public: This will format a duration tag as strftime.
Methods inherited from Formatter
format, #initialize, subclasses, subclasses_demodulized
Constructor Details
This class inherits a constructor from PopCap::Formatters::Formatter
Instance Method Details
#format ⇒ Object
Public: This will format a duration tag as strftime. It will raise a warning if the time is greater than 24 hours. Leading zeroes & colons are removed.
Examples
dur = Duration.new(420)
dur.format
# => '7:00'
18 19 20 21 22 |
# File 'lib/pop_cap/formatters/duration.rb', line 18 def format return unless value.to_i > 0 return if over_twenty_four_hours? human_readable_time end |