Class TZInfo::CountryTimezone
In: lib/tzinfo/country_timezone.rb
Parent: Object

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).

Methods

Attributes

description  [R]  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.
identifier  [R]  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).

[Source]

# File lib/tzinfo/country_timezone.rb, line 78
    def ==(ct)
      ct.respond_to?(:identifier) && ct.respond_to?(:latitude) &&
      ct.respond_to?(:longitude)  && ct.respond_to?(:description) &&
      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).

[Source]

# File lib/tzinfo/country_timezone.rb, line 61
    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).

[Source]

# File lib/tzinfo/country_timezone.rb, line 88
    def eql?(ct)
      self == ct
    end

Returns a hash of this CountryTimezone.

[Source]

# File lib/tzinfo/country_timezone.rb, line 93
    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.

[Source]

# File lib/tzinfo/country_timezone.rb, line 99
    def inspect
      "#<#{self.class}: #@identifier>"
    end

The latitude of this timezone in degrees as a Rational.

[Source]

# File lib/tzinfo/country_timezone.rb, line 66
    def latitude
      @latitude ||= Rational.send(:new!, @latitude_numerator, @latitude_denominator)
    end

The longitude of this timezone in degrees as a Rational.

[Source]

# File lib/tzinfo/country_timezone.rb, line 71
    def longitude
      @longitude ||= Rational.send(:new!, @longitude_numerator, @longitude_denominator)
    end

The Timezone (actually a TimezoneProxy for performance reasons).

[Source]

# File lib/tzinfo/country_timezone.rb, line 55
    def timezone
      Timezone.get_proxy(@identifier)
    end

[Validate]