HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/share/rubygems-integration/all/gems/tzinfo-2.0.4/lib/tzinfo/format2/timezone_index_definer.rb
# encoding: UTF-8

module TZInfo
  module Format2
    # Instances of {TimezoneIndexDefiner} are yielded by
    # {TimezoneIndexDefinition} to allow the time zone index to be defined.
    #
    # @private
    class TimezoneIndexDefiner #:nodoc:
      # @return [Array<String>] the identifiers of all data time zones.
      attr_reader :data_timezones

      # @return [Array<String>] the identifiers of all linked time zones.
      attr_reader :linked_timezones

      # Initializes a new TimezoneDefiner.
      #
      # @param string_deduper [StringDeduper] a {StringDeduper} instance to use
      #   when deduping identifiers.
      def initialize(string_deduper)
        @string_deduper = string_deduper
        @data_timezones = []
        @linked_timezones = []
      end

      # Adds a data time zone to the index.
      #
      # @param identifier [String] the time zone identifier.
      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

      # Adds a linked time zone to the index.
      #
      # @param identifier [String] the time zone identifier.
      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
    end
  end
end