Class: ISO3166::Subdivision
- Inherits:
-
Object
- Object
- ISO3166::Subdivision
- Defined in:
- lib/countries/subdivision.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#comments ⇒ Object
Returns the value of attribute comments.
-
#geo ⇒ Object
Returns the value of attribute geo.
-
#name ⇒ Object
Returns the value of attribute name.
-
#translations ⇒ Object
Returns the value of attribute translations.
-
#type ⇒ Object
Returns the value of attribute type.
-
#unofficial_names ⇒ Object
Returns the value of attribute unofficial_names.
Instance Method Summary collapse
- #[](attr_name) ⇒ Object
-
#code_with_translations ⇒ Hash
A hash with the subdivision code as key and the hash of translated subdivision names ( locale => name ) as value.
-
#initialize(attrs) ⇒ Subdivision
constructor
A new instance of Subdivision.
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
#code ⇒ Object
Returns the value of attribute code.
5 6 7 |
# File 'lib/countries/subdivision.rb', line 5 def code @code end |
#comments ⇒ Object
Returns the value of attribute comments.
5 6 7 |
# File 'lib/countries/subdivision.rb', line 5 def comments @comments end |
#geo ⇒ Object
Returns the value of attribute geo.
5 6 7 |
# File 'lib/countries/subdivision.rb', line 5 def geo @geo end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/countries/subdivision.rb', line 5 def name @name end |
#translations ⇒ Object
Returns the value of attribute translations.
5 6 7 |
# File 'lib/countries/subdivision.rb', line 5 def translations @translations end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/countries/subdivision.rb', line 5 def type @type end |
#unofficial_names ⇒ Object
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_translations ⇒ Hash
Returns 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 |