class GeoIP::City

Public Class Methods

new(*args) click to toggle source
# File lib/ffi-geoip/city.rb, line 8
def initialize(*args)
  initialize_geoip(*args)
end

Public Instance Methods

look_up(addr) click to toggle source
# File lib/ffi-geoip/city.rb, line 12
def look_up(addr)
  addr = value_to_addr(addr)
  check_type(addr, String)

  record = Record.new(FFIGeoIP.GeoIP_record_by_addr(@ptr, addr))

  if !record.null?
    hash = record.to_h
    FFIGeoIP.GeoIPRecord_delete(record)
    hash
  end
end