Module: Ravibhim::Continents

Defined in:
lib/ravibhim/continents.rb

Constant Summary collapse

CONTINENTS =
['Asia', 'Australia', 'Europe', 'Africa', 'North America', 'South America']
COUNTRY_TO_CONTINENT =

Load countries from yaml files. and build up country to continent mapping

{}
COUNTRY_TO_CODE =
{}
COUNTRIES =
COUNTRY_TO_CONTINENT.keys.sort

Class Method Summary collapse

Class Method Details

.get_continent(country) ⇒ Object



31
32
33
# File 'lib/ravibhim/continents.rb', line 31

def self.get_continent(country)
  COUNTRY_TO_CONTINENT[country]
end

.get_countries(cont) ⇒ Object



35
36
37
38
# File 'lib/ravibhim/continents.rb', line 35

def self.get_countries(cont)
  cont_const_name = cont.upcase.gsub(' ','_')
  const_get("#{cont_const_name}_COUNTRIES")
end

.get_iso_3166_1_code(country) ⇒ Object



40
41
42
# File 'lib/ravibhim/continents.rb', line 40

def self.get_iso_3166_1_code(country)
  COUNTRY_TO_CODE[country]
end