class GeoIP::Country

Public Class Methods

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

Public Instance Methods

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

  fix_encoding(
    :country_code => FFIGeoIP.GeoIP_country_code_by_addr(@ptr, addr),
    :country_code3 => FFIGeoIP.GeoIP_country_code3_by_addr(@ptr, addr),
    :country_name => FFIGeoIP.GeoIP_country_name_by_addr(@ptr, addr)
  )
end