Class: ISO3166::Subdivision

Inherits:
Object
  • Object
show all
Defined in:
lib/countries/subdivision.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ Subdivision

Returns a new instance of Subdivision.



13
14
15
16
17
# File 'lib/countries/subdivision.rb', line 13

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

Instance Attribute Details

#codeObject

Returns the value of attribute code.



5
6
7
# File 'lib/countries/subdivision.rb', line 5

def code
  @code
end

#commentsObject

Returns the value of attribute comments.



5
6
7
# File 'lib/countries/subdivision.rb', line 5

def comments
  @comments
end

#geoObject

Returns the value of attribute geo.



5
6
7
# File 'lib/countries/subdivision.rb', line 5

def geo
  @geo
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/countries/subdivision.rb', line 5

def name
  @name
end

#translationsObject

Returns the value of attribute translations.



5
6
7
# File 'lib/countries/subdivision.rb', line 5

def translations
  @translations
end

#typeObject

Returns the value of attribute type.



5
6
7
# File 'lib/countries/subdivision.rb', line 5

def type
  @type
end

#unofficial_namesObject

Returns the value of attribute unofficial_names.



5
6
7
# File 'lib/countries/subdivision.rb', line 5

def unofficial_names
  @unofficial_names
end

Instance Method Details

#[](attr_name) ⇒ Object



19
20
21
# File 'lib/countries/subdivision.rb', line 19

def [](attr_name)
  send attr_name
end

#code_with_translationsHash

Returns A hash with the subdivision code as key and the hash of translated subdivision names ( locale => name ) as value.

Returns:

  • (Hash)

    A hash with the subdivision code as key and the hash of translated subdivision names ( locale => name ) as value.



24
25
26
# File 'lib/countries/subdivision.rb', line 24

def code_with_translations
  { code => translations }
end