Class: TwitterCldr::Localized::LocalizedTime

Inherits:
LocalizedDateTime show all
Defined in:
lib/twitter_cldr/localized/localized_time.rb

Instance Attribute Summary

Attributes inherited from LocalizedDateTime

#calendar_type, #timezone

Attributes inherited from LocalizedObject

#base_obj, #formatter, #locale

Instance Method Summary collapse

Methods inherited from LocalizedDateTime

#additional_formats, #ago, #initialize, #to_additional_s, #to_s, #to_timespan, types, #until, #with_timezone

Methods inherited from LocalizedObject

#initialize, localize

Constructor Details

This class inherits a constructor from TwitterCldr::Localized::LocalizedDateTime

Instance Method Details

#gmtimeObject



24
25
26
# File 'lib/twitter_cldr/localized/localized_time.rb', line 24

def gmtime
  LocalizedTime.new(@base_obj.gmtime, @locale, chain_params)
end

#localtimeObject



28
29
30
# File 'lib/twitter_cldr/localized/localized_time.rb', line 28

def localtime
  LocalizedTime.new(@base_obj.localtime, @locale, chain_params)
end

#to_dateObject



20
21
22
# File 'lib/twitter_cldr/localized/localized_time.rb', line 20

def to_date
  LocalizedDate.new(@base_obj, @locale, chain_params)
end

#to_datetime(date) ⇒ Object



10
11
12
13
14
# File 'lib/twitter_cldr/localized/localized_time.rb', line 10

def to_datetime(date)
  date_obj = date.is_a?(LocalizedDate) ? date.base_obj : date
  dt = DateTime.parse("#{date_obj.strftime("%Y-%m-%d")}T#{@base_obj.strftime("%H:%M:%S%z")}")
  LocalizedDateTime.new(dt, @locale, chain_params)
end

#to_time(base_time = Time.now) ⇒ Object



16
17
18
# File 'lib/twitter_cldr/localized/localized_time.rb', line 16

def to_time(base_time = Time.now)
  self
end