Class: TwitterCldr::Shared::LocalizedTimespan

Inherits:
LocalizedObject show all
Defined in:
lib/twitter_cldr/core_ext/calendars/timespan.rb

Instance Attribute Summary

Attributes inherited from LocalizedObject

#base_obj, #formatter, #locale

Instance Method Summary collapse

Constructor Details

#initialize(seconds, locale) ⇒ LocalizedTimespan

Returns a new instance of LocalizedTimespan.


10
11
12
13
# File 'lib/twitter_cldr/core_ext/calendars/timespan.rb', line 10

def initialize(seconds, locale)
  @formatter = TwitterCldr::Formatters::TimespanFormatter.new(:locale => locale)
  @seconds = seconds
end

Instance Method Details

#to_s(unit = :default) ⇒ Object


15
16
17
# File 'lib/twitter_cldr/core_ext/calendars/timespan.rb', line 15

def to_s(unit = :default)
  @formatter.format(@seconds, unit)
end