class TZInfo::CountryTimezone
A Timezone within a Country. This contains extra information about the Timezone that is specific to the Country (a Timezone could be used by multiple countries).
Attributes
A description of this timezone in relation to the country, e.g. “Eastern Time”. This is usually nil for countries having only a single Timezone.
The zone identifier.
Public Instance Methods
Returns true if and only if the given CountryTimezone is equal to the current CountryTimezone (has the same identifer, latitude, longitude and description).
# File lib/tzinfo/country_timezone.rb, line 76 def ==(ct) ct.kind_of?(CountryTimezone) && identifier == ct.identifier && latitude == ct.latitude && longitude == ct.longitude && description == ct.description end
if description is not nil, this method returns description; otherwise it returns timezone.friendly_identifier(true).
# File lib/tzinfo/country_timezone.rb, line 59 def description_or_friendly_identifier description || timezone.friendly_identifier(true) end
Returns true if and only if the given CountryTimezone is equal to the current CountryTimezone (has the same identifer, latitude, longitude and description).
# File lib/tzinfo/country_timezone.rb, line 85 def eql?(ct) self == ct end
Returns a hash of this CountryTimezone.
# File lib/tzinfo/country_timezone.rb, line 90 def hash @identifier.hash ^ @latitude_numerator.hash ^ @latitude_denominator.hash ^ @longitude_numerator.hash ^ @longitude_denominator.hash ^ @description.hash end
Returns internal object state as a programmer-readable string.
# File lib/tzinfo/country_timezone.rb, line 96 def inspect "#<#{self.class}: #@identifier>" end
The latitude of this timezone in degrees as a Rational.
# File lib/tzinfo/country_timezone.rb, line 64 def latitude @latitude ||= RubyCoreSupport.rational_new!(@latitude_numerator, @latitude_denominator) end
The longitude of this timezone in degrees as a Rational.
# File lib/tzinfo/country_timezone.rb, line 69 def longitude @longitude ||= RubyCoreSupport.rational_new!(@longitude_numerator, @longitude_denominator) end
The Timezone (actually a TimezoneProxy for performance reasons).
# File lib/tzinfo/country_timezone.rb, line 53 def timezone Timezone.get_proxy(@identifier) end