class TZInfo::DataSources::CountryInfo

Represents a country and references to its time zones as returned by a {DataSource}.

Attributes

@return [String] the ISO 3166-1 alpha-2 country code.

@return [String] the name of the country.

@return [Array<CountryTimezone>] the time zones observed in the country.

Public Class Methods

Initializes a new {CountryInfo}. The passed in ‘code`, `name` and `zones` instances will be frozen.

@param code [String] an ISO 3166-1 alpha-2 country code. @param name [String] the name of the country. @param zones [Array<CountryTimezone>] the time zones observed in the

country.

@raise [ArgumentError] if ‘code`, `name` or `zones` is `nil`.

# File lib/tzinfo/data_sources/country_info.rb, line 26
def initialize(code, name, zones)
  raise ArgumentError, 'code must be specified' unless code
  raise ArgumentError, 'name must be specified' unless name
  raise ArgumentError, 'zones must be specified' unless zones
  @code = code.freeze
  @name = name.freeze
  @zones = zones.freeze
end

Public Instance Methods

@return [String] the internal object state as a programmer-readable

`String`.
# File lib/tzinfo/data_sources/country_info.rb, line 37
def inspect
  "#<#{self.class}: #@code>"
end