| Module | GeoIP |
| In: |
lib/geo_ip.rb
|
| db | [R] | The GeoIPCity database. |
Fetch location information from database and fill specific attributes of object.
| ip: | the IP address to be parsed. |
| v: | the object to call attributes on |
# File lib/geo_ip.rb, line 18
18: def location(ip, v)
19: r = db.look_up(ip)
20: return v if r.nil?
21: v.ip_latitude = r[:latitude]
22: v.ip_longitude = r[:longitude]
23: v.ip_country_code = r[:country_code]
24: v.ip_country_name = r[:country_name]
25: v.ip_city = r[:city]
26: v.ip_dma_code = r[:dma_code]
27: v.ip_area_code = r[:area_code]
28: v.ip_region = r[:region]
29: v
30: end