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
fablicop-1.10.2 vendor/bundle/ruby/3.2.0/gems/tzinfo-2.0.6/lib/tzinfo/data_sources/country_info.rb
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/tzinfo-2.0.6/lib/tzinfo/data_sources/country_info.rb
tzinfo-2.0.6 lib/tzinfo/data_sources/country_info.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/data_sources/country_info.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/data_sources/country_info.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/data_sources/country_info.rb
tzinfo-2.0.5 lib/tzinfo/data_sources/country_info.rb
ric-0.14.2 vendor/bundle/ruby/2.7.0/gems/tzinfo-2.0.4/lib/tzinfo/data_sources/country_info.rb
ric-0.14.1 vendor/bundle/ruby/2.7.0/gems/tzinfo-2.0.4/lib/tzinfo/data_sources/country_info.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/tzinfo-2.0.4/lib/tzinfo/data_sources/country_info.rb
ric-0.14.0 vendor/bundle/ruby/2.7.0/gems/tzinfo-2.0.4/lib/tzinfo/data_sources/country_info.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.4/lib/tzinfo/data_sources/country_info.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.4/lib/tzinfo/data_sources/country_info.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/tzinfo-2.0.4/lib/tzinfo/data_sources/country_info.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tzinfo-2.0.4/lib/tzinfo/data_sources/country_info.rb
tzinfo-2.0.4 lib/tzinfo/data_sources/country_info.rb
tzinfo-2.0.3 lib/tzinfo/data_sources/country_info.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/tzinfo-2.0.2/lib/tzinfo/data_sources/country_info.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/tzinfo-2.0.2/lib/tzinfo/data_sources/country_info.rb
tzinfo-2.0.2 lib/tzinfo/data_sources/country_info.rb