Class: TZInfo::DataSources::CountryInfo
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/tzinfo/data_sources/country_info.rb |
Overview
Represents a country and references to its time zones as returned by a
::TZInfo::DataSource
.
Class Method Summary
-
.new(code, name, zones) ⇒ CountryInfo
constructor
Initializes a new
CountryInfo
.
Instance Attribute Summary
- #code ⇒ String readonly
- #name ⇒ String readonly
- #zones ⇒ Array<CountryTimezone> readonly
Instance Method Summary
Constructor Details
.new(code, name, zones) ⇒ CountryInfo
[ GitHub ]
# 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
Instance Attribute Details
#code ⇒ String
(readonly)
# File 'lib/tzinfo/data_sources/country_info.rb', line 10
attr_reader :code
#name ⇒ String
(readonly)
# File 'lib/tzinfo/data_sources/country_info.rb', line 13
attr_reader :name
#zones ⇒ Array
<CountryTimezone> (readonly)
# File 'lib/tzinfo/data_sources/country_info.rb', line 16
attr_reader :zones
Instance Method Details
#inspect ⇒ String
# File 'lib/tzinfo/data_sources/country_info.rb', line 37
def inspect "#<#{self.class}: #@code>" end