Module: TZInfo::Format2::TimezoneDefinition::ClassMethods Private
Do not use. This module is for internal use only.
Relationships & Source Files | |
Defined in: | lib/tzinfo/format2/timezone_definition.rb |
Overview
Class methods for inclusion.
Instance Method Summary
- #get ⇒ TimezoneInfo Internal use only
-
#linked_timezone(identifier, link_to_identifier)
private
Internal use only
Defines a linked time zone.
-
#timezone(identifier) {|definer| ... }
private
Internal use only
Defines a data time zone.
- #timezone_definer_class ⇒ Class private Internal use only
Instance Method Details
#get ⇒ TimezoneInfo
# File 'lib/tzinfo/format2/timezone_definition.rb', line 23
def get @timezone end
#linked_timezone(identifier, link_to_identifier) (private)
Defines a linked time zone.
# File 'lib/tzinfo/format2/timezone_definition.rb', line 64
def linked_timezone(identifier, link_to_identifier) # Dedupe non-frozen literals from format 1 on all Ruby versions and # format 2 on Ruby < 2.3 (without frozen_string_literal support). string_deduper = StringDeduper.global @timezone = DataSources::LinkedTimezoneInfo.new(string_deduper.dedupe(identifier), string_deduper.dedupe(link_to_identifier)) end
#timezone(identifier) {|definer| ... } (private)
Defines a data time zone.
# File 'lib/tzinfo/format2/timezone_definition.rb', line 41
def 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). string_deduper = StringDeduper.global identifier = string_deduper.dedupe(identifier) definer = timezone_definer_class.new(string_deduper) yield definer transitions = definer.transitions @timezone = if transitions.empty? DataSources::ConstantOffsetDataTimezoneInfo.new(identifier, definer.first_offset) else DataSources::TransitionsDataTimezoneInfo.new(identifier, transitions) end end
#timezone_definer_class ⇒ Class
(private)
# File 'lib/tzinfo/format2/timezone_definition.rb', line 31
def timezone_definer_class TimezoneDefiner end