Sha256: 79bfcb988eab1a74024f373629fe4d2f17dfe49fcfea221f5ebdab676b041e5d

Contents?: true

Size: 1.36 KB

Versions: 42

Compression:

Stored size: 1.36 KB

Contents

# encoding: UTF-8
# frozen_string_literal: true

module TZInfo
  module DataSources
    # Represents a country and references to its time zones as returned by a
    # {DataSource}.
    class CountryInfo
      # @return [String] the ISO 3166-1 alpha-2 country code.
      attr_reader :code

      # @return [String] the name of the country.
      attr_reader :name

      # @return [Array<CountryTimezone>] the time zones observed in the country.
      attr_reader :zones

      # Initializes a new {CountryInfo}. The passed in `code`, `name` and
      # `zones` instances will be frozen.
      #
      # @param code [String] an ISO 3166-1 alpha-2 country code.
      # @param name [String] the name of the country.
      # @param zones [Array<CountryTimezone>] the time zones observed in the
      #   country.
      # @raise [ArgumentError] if `code`, `name` or `zones` is `nil`.
      def initialize(code, name, zones)
        raise ArgumentError, 'code must be specified' unless code
        raise ArgumentError, 'name must be specified' unless name
        raise ArgumentError, 'zones must be specified' unless zones
        @code = code.freeze
        @name = name.freeze
        @zones = zones.freeze
      end

      # @return [String] the internal object state as a programmer-readable
      #   `String`.
      def inspect
        "#<#{self.class}: #@code>"
      end
    end
  end
end

Version data entries

42 entries across 38 versions & 19 rubygems

Version Path
fluent-plugin-nuopenlineage-light-0.1.0 vendor/bundle/ruby/3.3.0/gems/tzinfo-2.0.6/lib/tzinfo/data_sources/country_info.rb
fluent-plugin-openlineage-light-0.1.4 vendor/bundle/ruby/3.3.0/gems/tzinfo-2.0.6/lib/tzinfo/data_sources/country_info.rb
fluent-plugin-openlineage-light-0.1.3 vendor/bundle/ruby/3.3.0/gems/tzinfo-2.0.6/lib/tzinfo/data_sources/country_info.rb
fluent-plugin-openlineage-0.1.0 vendor/bundle/ruby/3.3.0/gems/tzinfo-2.0.6/lib/tzinfo/data_sources/country_info.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/tzinfo-2.0.6/lib/tzinfo/data_sources/country_info.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/tzinfo-2.0.6/lib/tzinfo/data_sources/country_info.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/tzinfo-2.0.6/lib/tzinfo/data_sources/country_info.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/tzinfo-2.0.6/lib/tzinfo/data_sources/country_info.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/tzinfo-2.0.6/lib/tzinfo/data_sources/country_info.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/tzinfo-2.0.6/lib/tzinfo/data_sources/country_info.rb
mlh-rubocop-config-1.0.3 vendor/bundle/ruby/3.2.0/gems/tzinfo-2.0.6/lib/tzinfo/data_sources/country_info.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/tzinfo-2.0.4/lib/tzinfo/data_sources/country_info.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/tzinfo-2.0.5/lib/tzinfo/data_sources/country_info.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/tzinfo-2.0.6/lib/tzinfo/data_sources/country_info.rb
mlh-rubocop-config-1.0.2 vendor/bundle/ruby/3.2.0/gems/tzinfo-2.0.6/lib/tzinfo/data_sources/country_info.rb
fablicop-1.10.3 vendor/bundle/ruby/3.2.0/gems/tzinfo-2.0.6/lib/tzinfo/data_sources/country_info.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/tzinfo-2.0.6/lib/tzinfo/data_sources/country_info.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/tzinfo-2.0.5/lib/tzinfo/data_sources/country_info.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/tzinfo-2.0.4/lib/tzinfo/data_sources/country_info.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/data_sources/country_info.rb