Module GeoIP
In: lib/geo_ip.rb

Methods

database   location  

Attributes

db  [R]  The GeoIPCity database.

Public Class methods

Set the GeoIPCity database.

loc:a string to the filesystem database location.

[Source]

    # File lib/geo_ip.rb, line 9
 9:     def database(loc)
10:       @db = GeoIPCity::Database.new(loc, :filesystem)
11:     end

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

[Source]

    # 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

Helioid