Class: Infostrada::Nation
- Inherits:
-
Object
- Object
- Infostrada::Nation
- Defined in:
- lib/infostrada/nation.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#short_name ⇒ Object
Returns the value of attribute short_name.
Instance Method Summary collapse
-
#initialize(hash, prefix) ⇒ Nation
constructor
A new instance of Nation.
- #natio=(name) ⇒ Object
- #natio_geo_id=(id) ⇒ Object
- #natio_short=(short_name) ⇒ Object
Constructor Details
#initialize(hash, prefix) ⇒ Nation
Returns a new instance of Nation.
5 6 7 8 9 10 |
# File 'lib/infostrada/nation.rb', line 5 def initialize(hash, prefix) hash.each do |key, value| match = key.snake_case.match(/[cn]_#{prefix}_?(natio\w*)$/) self.send("#{$1}=", value) if match end end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/infostrada/nation.rb', line 3 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/infostrada/nation.rb', line 3 def name @name end |
#short_name ⇒ Object
Returns the value of attribute short_name.
3 4 5 |
# File 'lib/infostrada/nation.rb', line 3 def short_name @short_name end |
Instance Method Details
#natio=(name) ⇒ Object
16 17 18 |
# File 'lib/infostrada/nation.rb', line 16 def natio=(name) self.name = name end |
#natio_geo_id=(id) ⇒ Object
12 13 14 |
# File 'lib/infostrada/nation.rb', line 12 def natio_geo_id=(id) self.id = id end |
#natio_short=(short_name) ⇒ Object
20 21 22 |
# File 'lib/infostrada/nation.rb', line 20 def natio_short=(short_name) self.short_name = short_name end |