class TwitterCldr::Localized::LocalizedTime

Public Instance Methods

gmtime() click to toggle source
# File lib/twitter_cldr/localized/localized_time.rb, line 24
def gmtime
  LocalizedTime.new(@base_obj.gmtime, @locale, chain_params)
end
localtime() click to toggle source
# File lib/twitter_cldr/localized/localized_time.rb, line 28
def localtime
  LocalizedTime.new(@base_obj.localtime, @locale, chain_params)
end
to_date() click to toggle source
# File lib/twitter_cldr/localized/localized_time.rb, line 20
def to_date
  LocalizedDate.new(@base_obj, @locale, chain_params)
end
to_datetime(date) click to toggle source
# 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) click to toggle source
# File lib/twitter_cldr/localized/localized_time.rb, line 16
def to_time(base_time = Time.now)
  self
end

Protected Instance Methods

base_in_timezone() click to toggle source
# File lib/twitter_cldr/localized/localized_time.rb, line 34
def base_in_timezone
  timezone_info.utc_to_local(@base_obj.utc)
end
data_reader_for(type, options = {}) click to toggle source
# File lib/twitter_cldr/localized/localized_time.rb, line 38
def data_reader_for(type, options = {})
  TwitterCldr::DataReaders::TimeDataReader.new(
    locale, options.merge({
      calendar_type: calendar_type,
      type: type
    })
  )
end