Class: Infostrada::Nation

Inherits:
Object
  • Object
show all
Defined in:
lib/infostrada/nation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/infostrada/nation.rb', line 3

def id
  @id
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/infostrada/nation.rb', line 3

def name
  @name
end

#short_nameObject

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