Class: TZInfo::Country

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

_load(data)

Loads a marshalled Country.

all()

Returns an Array of all the defined Countries.

all_codes()

Returns an Array of all the valid country codes.

get(identifier)

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

new(identifier)

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

### Public Instance methods

<=>(c)

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.

_dump(limit)

Dumps this Country for marshalling.

code()

The ISO 3166 country code.

eql?(c)

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

hash()

Returns a hash value for this Country.

inspect()

Returns internal object state as a programmer-readable string.

name()

The name of the country.

to_s()

Alias for name.

zone_identifiers()

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).

zone_info()

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

zones()

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]