Class: Nation

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

Defined Under Namespace

Classes: HtmlFile, JsonFile, NationGeneral, NationInfo

Instance Method Summary collapse

Constructor Details

#initializeNation

Returns a new instance of Nation.



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

def initialize
  @stored_info = {}
end

Instance Method Details

#info_to_htmlObject



25
26
27
# File 'lib/nation.rb', line 25

def info_to_html
  HtmlFile.convert_html_file(@stored_info)
end

#info_to_jsonObject



21
22
23
# File 'lib/nation.rb', line 21

def info_to_json
  JsonFile.convert_json_file(@stored_info)    
end

#nation_info(nation_name) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/nation.rb', line 7

def nation_info(nation_name)
  nation_name = nation_name.downcase.split.map(&:capitalize).join("_")
  general = NationGeneral.new(nation_name)
  nation_general = general.get_raw_data 

  info = NationInfo.new(nation_name)
  info_country = info.get_raw_data

   @stored_info = {:name => nation_general[0], :capital => nation_general[1], :continent => nation_general[2], :region => nation_general[3], :population => nation_general[4], :languages => nation_general[5], :about_country => info_country}

   @stored_info

end