Class: GeoipRedis::LocationsParser
- Inherits:
-
Object
- Object
- GeoipRedis::LocationsParser
- Defined in:
- lib/geoip_redis/locations_parser.rb
Instance Method Summary collapse
Instance Method Details
#city(data) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/geoip_redis/locations_parser.rb', line 20 def city(data) subdivision_1_iso_code, subdivision_1_name, subdivision_2_iso_code, subdivision_2_name, city_name, metro_code, time_zone = data[SUBDIVISION_1_ISO_CODE..-1] location = { subdivision_1_iso_code: subdivision_1_iso_code, subdivision_1_name: subdivision_1_name, subdivision_2_iso_code: subdivision_2_iso_code, subdivision_2_name: subdivision_2_name, city_name: city_name, metro_code: metro_code, time_zone: time_zone, } country(data).merge(location) end |
#country(data) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/geoip_redis/locations_parser.rb', line 3 def country(data) geoname_id, locale_code, continent_code, continent_name, country_iso_code, country_name = data { location_id: geoname_id, locale_code: locale_code, continent_code: continent_code, continent_name: continent_name, country_iso_code: country_iso_code, country_name: country_name, } end |