Module: Geolookup::Country
- Defined in:
- lib/geolookup/country.rb
Constant Summary collapse
- COUNTRY_NAME_TO_CODE_FILE =
"./lib/data/COUNTRY_NAME_TO_CODE.yml"- COUNTRY_CODE_TO_NAME_FILE =
"./lib/data/COUNTRY_CODE_TO_NAME.yml"- COUNTRY_LAT_LONG_FILE =
"./lib/data/COUNTRY_LAT_LONG.yml"
Class Method Summary collapse
- .code_to_name(country_code) ⇒ Object
- .name_to_code(country_name) ⇒ Object
-
.name_to_lat_long(country_name) ⇒ Object
def self.code_to_lat_long(country_code) LAT_LONG end.
Class Method Details
.code_to_name(country_code) ⇒ Object
26 27 28 29 |
# File 'lib/geolookup/country.rb', line 26 def self.code_to_name(country_code) @country_code_to_name ||= Geolookup.load_hash_from_file(COUNTRY_CODE_TO_NAME_FILE) @country_code_to_name[country_code.to_s.upcase] end |
.name_to_code(country_name) ⇒ Object
21 22 23 24 |
# File 'lib/geolookup/country.rb', line 21 def self.name_to_code(country_name) @country_name_to_code ||= Geolookup.load_hash_from_file(COUNTRY_NAME_TO_CODE_FILE) @country_name_to_code[country_name.to_s.upcase] end |
.name_to_lat_long(country_name) ⇒ Object
def self.code_to_lat_long(country_code)
LAT_LONG[country_code.to_s.upcase]
end
35 36 37 38 |
# File 'lib/geolookup/country.rb', line 35 def self.name_to_lat_long(country_name) @country_lat_long ||= Geolookup.load_hash_from_file(COUNTRY_LAT_LONG_FILE) @country_lat_long[country_name.to_s.upcase] end |