Class: TZInfo::CountryInfo
- Inherits:
-
Object
- Object
- TZInfo::CountryInfo
- Defined in:
- lib/tzinfo/country_info.rb
Overview
Represents a country and references to its timezones as returned by a DataSource.
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
The ISO 3166 country code.
-
#name ⇒ Object
readonly
The name of the country.
Instance Method Summary collapse
-
#initialize(code, name) ⇒ CountryInfo
constructor
Constructs a new CountryInfo with an ISO 3166 country code and name.
-
#inspect ⇒ Object
Returns internal object state as a programmer-readable string.
-
#zone_identifiers ⇒ Object
Returns a frozen array of all the zone identifiers for the country.
-
#zones ⇒ Object
Returns a frozen array of all the timezones for the for the country as CountryTimezone instances.
Constructor Details
#initialize(code, name) ⇒ CountryInfo
Constructs a new CountryInfo with an ISO 3166 country code and name
12 13 14 15 |
# File 'lib/tzinfo/country_info.rb', line 12 def initialize(code, name) @code = code @name = name end |
Instance Attribute Details
#code ⇒ Object (readonly)
The ISO 3166 country code.
6 7 8 |
# File 'lib/tzinfo/country_info.rb', line 6 def code @code end |
#name ⇒ Object (readonly)
The name of the country.
9 10 11 |
# File 'lib/tzinfo/country_info.rb', line 9 def name @name end |
Instance Method Details
#inspect ⇒ Object
Returns internal object state as a programmer-readable string.
18 19 20 |
# File 'lib/tzinfo/country_info.rb', line 18 def inspect "#<#{self.class}: #@code>" end |
#zone_identifiers ⇒ Object
Returns a frozen array of all the zone identifiers for the country. The identifiers are ordered by importance according to the DataSource.
24 25 26 |
# File 'lib/tzinfo/country_info.rb', line 24 def zone_identifiers raise_not_implemented('zone_identifiers') end |
#zones ⇒ Object
Returns a frozen array of all the timezones for the for the country as CountryTimezone instances.
The timezones are ordered by importance according to the DataSource.
32 33 34 |
# File 'lib/tzinfo/country_info.rb', line 32 def zones raise_not_implemented('zones') end |