Class: TwitterCldr::Timezones::GenericLocation

Inherits:
Location
  • Object
show all
Defined in:
lib/twitter_cldr/timezones/generic_location.rb

Constant Summary collapse

DEFAULT_CITY_EXCLUSION_PATTERN =
/Etc\/.*|SystemV\/.*|.*\/Riyadh8[7-9]/
DST_CHECK_RANGE =
184 * 24 * 60 * 60
UNKNOWN_DEFAULT =
'Unknown'.freeze
FORMATS =
[
  :generic_location,
  :generic_short,
  :generic_long,
  :specific_short,
  :specific_long,
  :exemplar_location
].freeze
Territories =
TwitterCldr::Shared::Territories
Utils =
TwitterCldr::Utils

Instance Attribute Summary

Attributes inherited from Location

#tz

Instance Method Summary collapse

Methods inherited from Location

#initialize, #resource, #tz_id

Constructor Details

This class inherits a constructor from TwitterCldr::Timezones::Location

Instance Method Details

#display_name_for(date, fmt = :generic_location) ⇒ Object


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/twitter_cldr/timezones/generic_location.rb', line 24

def display_name_for(date, fmt = :generic_location)
  case fmt
    when :generic_location
      generic_location_display_name
    when :generic_short
      generic_short_display_name(date) || generic_location_display_name
    when :generic_long
      generic_long_display_name(date) || generic_location_display_name
    when :specific_short
      specific_short_display_name(date)
    when :specific_long
      specific_long_display_name(date)
    when :exemplar_location
      exemplar_city
    else
      raise ArgumentError, "'#{fmt}' is not a valid generic timezone format, "\
        "must be one of #{FORMATS.join(', ')}"
  end
end