Sha256: f8e6111e0c60213ff5f7222faa300b42eca3fca9e3b5f69c1853a51cd9b219b2

Contents?: true

Size: 632 Bytes

Versions: 7

Compression:

Stored size: 632 Bytes

Contents

# frozen_string_literal: true

module ISO3166
  class Subdivision
    attr_accessor :name,
                  :code,
                  :unofficial_names,
                  :geo,
                  :translations,
                  :comments,
                  :type

    def initialize(attrs)
      attrs.each_pair do |k, v|
        send "#{k}=", v
      end
    end

    def [](attr_name)
      send attr_name
    end

    # @return [Hash] A hash with the subdivision code as key and the hash of translated subdivision names ( locale => name ) as value.
    def code_with_translations
      { code => translations }
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
countries-7.0.0 lib/countries/subdivision.rb
countries-6.0.0 lib/countries/subdivision.rb
countries-5.7.2 lib/countries/subdivision.rb
countries-5.7.1 lib/countries/subdivision.rb
countries-5.7.0 lib/countries/subdivision.rb
countries-5.6.0 lib/countries/subdivision.rb
countries-5.5.0 lib/countries/subdivision.rb