123456789_123456789_123456789_123456789_123456789_

Class: TZInfo::Format2::TimezoneIndexDefiner Private

Relationships & Source Files
Inherits: Object
Defined in: lib/tzinfo/format2/timezone_index_definer.rb

Overview

Instances of TimezoneIndexDefiner are yielded by TimezoneIndexDefinition to allow the time zone index to be defined.

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(string_deduper) ⇒ TimezoneIndexDefiner

Initializes a new TimezoneDefiner.

Parameters:

[ GitHub ]

  
# File 'lib/tzinfo/format2/timezone_index_definer.rb', line 20

def initialize(string_deduper)
  @string_deduper = string_deduper
  @data_timezones = []
  @linked_timezones = []
end

Instance Attribute Details

#data_timezones ⇒ Array<String> (readonly)

Returns:

  • (Array<String>) —

    the identifiers of all data time zones.

[ GitHub ]

  
# File 'lib/tzinfo/format2/timezone_index_definer.rb', line 11

attr_reader :data_timezones

#linked_timezones ⇒ Array<String> (readonly)

Returns:

  • (Array<String>) —

    the identifiers of all linked time zones.

[ GitHub ]

  
# File 'lib/tzinfo/format2/timezone_index_definer.rb', line 14

attr_reader :linked_timezones

Instance Method Details

#data_timezone(identifier)

Adds a data time zone to the index.

Parameters:

  • identifier (String) —

    the time zone identifier.

[ GitHub ]

  
# File 'lib/tzinfo/format2/timezone_index_definer.rb', line 29

def data_timezone(identifier)
  # Dedupe non-frozen literals from format 1 on all Ruby versions and
  # format 2 on Ruby < 2.3 (without frozen_string_literal support).
  @data_timezones << @string_deduper.dedupe(identifier)
end

#linked_timezone(identifier)

Adds a linked time zone to the index.

Parameters:

  • identifier (String) —

    the time zone identifier.

[ GitHub ]

  
# File 'lib/tzinfo/format2/timezone_index_definer.rb', line 38

def linked_timezone(identifier)
  # Dedupe non-frozen literals from format 1 on all Ruby versions and
  # format 2 on Ruby < 2.3 (without frozen_string_literal support).
  @linked_timezones << @string_deduper.dedupe(identifier)
end