Class: TZInfo::Format2::TimezoneIndexDefiner

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/format2/timezone_index_definer.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string_deduper) ⇒ TimezoneIndexDefiner

Initializes a new TimezoneDefiner.

Parameters:

  • string_deduper (StringDeduper)

    a StringDeduper instance to use when deduping identifiers.



20
21
22
23
24
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/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_timezonesArray<String> (readonly)

Returns the identifiers of all data time zones.

Returns:

  • (Array<String>)

    the identifiers of all data time zones.



11
12
13
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/format2/timezone_index_definer.rb', line 11

def data_timezones
  @data_timezones
end

#linked_timezonesArray<String> (readonly)

Returns the identifiers of all linked time zones.

Returns:

  • (Array<String>)

    the identifiers of all linked time zones.



14
15
16
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/format2/timezone_index_definer.rb', line 14

def linked_timezones
  @linked_timezones
end

Instance Method Details

#data_timezone(identifier) ⇒ Object

Adds a data time zone to the index.

Parameters:

  • identifier (String)

    the time zone identifier.



29
30
31
32
33
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/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) ⇒ Object

Adds a linked time zone to the index.

Parameters:

  • identifier (String)

    the time zone identifier.



38
39
40
41
42
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/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