Class: TZInfo::DataSources::LinkedTimezoneInfo

Inherits:
TimezoneInfo
  • Object
show all
Defined in:
lib/tzinfo/data_sources/linked_timezone_info.rb

Overview

Represents a time zone that is defined as a link to or alias of another zone.

Instance Attribute Summary collapse

Attributes inherited from TimezoneInfo

#identifier

Instance Method Summary collapse

Methods inherited from TimezoneInfo

#inspect

Constructor Details

#initialize(identifier, link_to_identifier) ⇒ LinkedTimezoneInfo

Initializes a new TZInfo::DataSources::LinkedTimezoneInfo. The passed in identifier and link_to_identifier instances will be frozen.

nil.

Parameters:

  • identifier (String)

    the identifier of the time zone.

  • link_to_identifier (String)

    the identifier of the time zone that this zone link to.

Raises:

  • (ArgumentError)

    if identifier or link_to_identifier are


20
21
22
23
24
# File 'lib/tzinfo/data_sources/linked_timezone_info.rb', line 20

def initialize(identifier, link_to_identifier)
  super(identifier)
  raise ArgumentError, 'link_to_identifier must be specified' unless link_to_identifier
  @link_to_identifier = link_to_identifier.freeze
end

Instance Attribute Details

(that this zone links to or is an alias for).

Returns:

  • (String)

    the identifier of the time zone that provides the data


10
11
12
# File 'lib/tzinfo/data_sources/linked_timezone_info.rb', line 10

def link_to_identifier
  @link_to_identifier
end

Instance Method Details

#create_timezoneLinkedTimezone

Returns a new LinkedTimezone instance for the time zone represented by this TZInfo::DataSources::LinkedTimezoneInfo.

Returns:


28
29
30
# File 'lib/tzinfo/data_sources/linked_timezone_info.rb', line 28

def create_timezone
  LinkedTimezone.new(self)
end