Sha256: 71f82260754417f7fcff827942d3c5faf2540b1051f5108e241bf50f9bb22610

Contents?: true

Size: 1.19 KB

Versions: 37

Compression:

Stored size: 1.19 KB

Contents

module TZInfo  
  # Represents information about a country returned by ZoneinfoDataSource.
  #
  # @private
  class ZoneinfoCountryInfo < CountryInfo #:nodoc:
    # Constructs a new CountryInfo with an ISO 3166 country code, name and 
    # an array of CountryTimezones.
    def initialize(code, name, zones)
      super(code, name)
      @zones = zones.dup.freeze
      @zone_identifiers = nil
    end
    
    # Returns a frozen array of all the zone identifiers for the country ordered
    # geographically, most populous first.
    def zone_identifiers
      # Thread-safety: It is possible that the value of @zone_identifiers may be 
      # calculated multiple times in concurrently executing threads. It is not 
      # worth the overhead of locking to ensure that @zone_identifiers is only 
      # calculated once.
    
      unless @zone_identifiers
        result = zones.collect {|zone| zone.identifier}.freeze
        return result if frozen?
        @zone_identifiers = result
      end
      
      @zone_identifiers
    end
    
    # Returns a frozen array of all the timezones for the for the country 
    # ordered geographically, most populous first.
    def zones
      @zones
    end
  end
end

Version data entries

37 entries across 36 versions & 14 rubygems

Version Path
mumukit-content-type-1.12.1 vendor/bundle/ruby/2.7.0/gems/tzinfo-1.2.11/lib/tzinfo/zoneinfo_country_info.rb
mumukit-content-type-1.12.0 vendor/bundle/ruby/2.7.0/gems/tzinfo-1.2.11/lib/tzinfo/zoneinfo_country_info.rb
tzinfo-1.2.11 lib/tzinfo/zoneinfo_country_info.rb
tzinfo-1.2.10 lib/tzinfo/zoneinfo_country_info.rb
mumukit-content-type-1.11.1 vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.9/lib/tzinfo/zoneinfo_country_info.rb
tzinfo-1.2.9 lib/tzinfo/zoneinfo_country_info.rb
tzinfo-1.2.8 lib/tzinfo/zoneinfo_country_info.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.7/lib/tzinfo/zoneinfo_country_info.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.6/lib/tzinfo/zoneinfo_country_info.rb
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/tzinfo-1.2.5/lib/tzinfo/zoneinfo_country_info.rb
tzinfo-1.2.7 lib/tzinfo/zoneinfo_country_info.rb
argon-1.3.1 vendor/bundle/ruby/2.7.0/gems/tzinfo-1.2.6/lib/tzinfo/zoneinfo_country_info.rb
symbolic_enum-1.1.5 vendor/bundle/ruby/2.7.0/gems/tzinfo-1.2.6/lib/tzinfo/zoneinfo_country_info.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/tzinfo-1.2.6/lib/tzinfo/zoneinfo_country_info.rb
tzinfo-1.2.6 lib/tzinfo/zoneinfo_country_info.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/tzinfo-1.2.5/lib/tzinfo/zoneinfo_country_info.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/tzinfo-1.2.5/lib/tzinfo/zoneinfo_country_info.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/tzinfo-1.2.5/lib/tzinfo/zoneinfo_country_info.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/tzinfo-1.2.5/lib/tzinfo/zoneinfo_country_info.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/tzinfo-1.2.5/lib/tzinfo/zoneinfo_country_info.rb