Class: TZInfo::CountryTimezone
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/country_timezone.rb
Overview
Information about a time zone used by a Country.
Instance Attribute Summary collapse
-
#description ⇒ String
readonly
A description of this time zone in relation to the country, e.g.
-
#identifier ⇒ String
readonly
The identifier of the Timezone being described.
-
#latitude ⇒ Rational
readonly
The latitude of this time zone in degrees.
-
#longitude ⇒ Rational
readonly
The longitude of this time zone in degrees.
Instance Method Summary collapse
-
#==(ct) ⇒ TrueClass
Tests if the given object is equal to the current instance (has the same identifier, latitude, longitude and description).
-
#description_or_friendly_identifier ⇒ String
The #description if present, otherwise a human-readable representation of the identifier (using Timezone#friendly_identifier).
-
#eql?(ct) ⇒ Boolean
Tests if the given object is equal to the current instance (has the same identifier, latitude, longitude and description).
-
#hash ⇒ Integer
#longitude and #description.
-
#initialize(identifier, latitude, longitude, description = nil) ⇒ CountryTimezone
constructor
Creates a new CountryTimezone.
-
#timezone ⇒ Timezone
Returns the associated Timezone.
Constructor Details
#initialize(identifier, latitude, longitude, description = nil) ⇒ CountryTimezone
Creates a new TZInfo::CountryTimezone.
The passed in identifier and description instances will be frozen.
TZInfo::CountryTimezone instances should normally only be constructed by implementations of DataSource.
44 45 46 47 48 49 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/country_timezone.rb', line 44 def initialize(identifier, latitude, longitude, description = nil) @identifier = identifier.freeze @latitude = latitude @longitude = longitude @description = description && description.freeze end |
Instance Attribute Details
#description ⇒ String (readonly)
A description of this time zone in relation to the country, e.g. “Eastern Time”. This is usually ‘nil` for countries that have a single time zone.
31 32 33 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/country_timezone.rb', line 31 def description @description end |
#identifier ⇒ String (readonly)
Returns the identifier of the Timezone being described.
7 8 9 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/country_timezone.rb', line 7 def identifier @identifier end |
#latitude ⇒ Rational (readonly)
The latitude of this time zone in degrees. Positive numbers are degrees north and negative numbers are degrees south.
Note that depending on the data source, the position given by #latitude and #longitude may not be within the country.
16 17 18 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/country_timezone.rb', line 16 def latitude @latitude end |
#longitude ⇒ Rational (readonly)
The longitude of this time zone in degrees. Positive numbers are degrees east and negative numbers are degrees west.
Note that depending on the data source, the position given by #latitude and #longitude may not be within the country.
25 26 27 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/country_timezone.rb', line 25 def longitude @longitude end |
Instance Method Details
#==(ct) ⇒ TrueClass
Tests if the given object is equal to the current instance (has the same identifier, latitude, longitude and description).
72 73 74 75 76 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/country_timezone.rb', line 72 def ==(ct) ct.kind_of?(CountryTimezone) && identifier == ct.identifier && latitude == ct.latitude && longitude == ct.longitude && description == ct.description end |
#description_or_friendly_identifier ⇒ String
Returns the #description if present, otherwise a human-readable representation of the identifier (using Timezone#friendly_identifier).
63 64 65 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/country_timezone.rb', line 63 def description_or_friendly_identifier description || timezone.friendly_identifier(true) end |
#eql?(ct) ⇒ Boolean
Tests if the given object is equal to the current instance (has the same identifier, latitude, longitude and description).
83 84 85 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/country_timezone.rb', line 83 def eql?(ct) self == ct end |
#hash ⇒ Integer
#longitude and #description.
89 90 91 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/country_timezone.rb', line 89 def hash [@identifier, @latitude, @longitude, @description].hash end |
#timezone ⇒ Timezone
Returns the associated Timezone.
The result is actually an instance of TimezoneProxy in order to defer loading of the time zone transition data until it is first needed.
57 58 59 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/country_timezone.rb', line 57 def timezone Timezone.get_proxy(@identifier) end |