Class TZInfo::Country
In: lib/tzinfo/country.rb
Parent: Object

An ISO 3166 country. Can be used to get a list of Timezones for a country. For example:

 us = Country.get('US')
 us.zone_identifiers
 us.zones
 us.zone_info

Methods

<=>   _dump   _load   all   all_codes   code   eql?   get   hash   inspect   name   new   to_s   zone_identifiers   zone_info   zone_names   zones  

Included Modules

Comparable

Public Class methods

Loads a marshalled Country.

Returns an Array of all the defined Countries.

Returns an Array of all the valid country codes.

Gets a Country by its ISO 3166 code. Raises an InvalidCountryCode exception if it couldn‘t be found.

If identifier is a CountryInfo object, initializes the Country instance, otherwise calls get(identifier).

Public Instance methods

Compare two Countries based on their code. Returns -1 if c is less than self, 0 if c is equal to self and +1 if c is greater than self.

Dumps this Country for marshalling.

The ISO 3166 country code.

Returns true if and only if the code of c is equal to the code of this Country.

Returns a hash value for this Country.

Returns internal object state as a programmer-readable string.

The name of the country.

Alias for name.

Returns a frozen array of all the zone identifiers for the country. These are in an order that

  (1) makes some geographical sense, and
  (2) puts the most populous zones first, where that does not contradict (1).

Returns a frozen array of all the timezones for the for the country as CountryTimezone instances (containing extra information about each zone). These are in an order that

  (1) makes some geographical sense, and
  (2) puts the most populous zones first, where that does not contradict (1).
zone_names()

Alias for zone_identifiers

An array of all the Timezones for this country. Returns TimezoneProxy objects to avoid the overhead of loading Timezone definitions until a conversion is actually required. The Timezones are returned in an order that

  (1) makes some geographical sense, and
  (2) puts the most populous zones first, where that does not contradict (1).

[Validate]