module CurrencyByIp

Constants

COUNTRY_TO_CURRENCY
VERSION

Public Class Methods

find_by_country_code(country_code) click to toggle source
# File lib/currency_by_ip.rb, line 15
def self.find_by_country_code(country_code)
  COUNTRY_TO_CURRENCY[country_code]
end
find_by_ip(ip, geoip_data_path: "lib/currency_by_ip/GeoIP.dat", geoip: nil) click to toggle source
# File lib/currency_by_ip.rb, line 7
def self.find_by_ip(ip,
    geoip_data_path: "lib/currency_by_ip/GeoIP.dat",
    geoip: nil)
  geoip ||= GeoIP.new(geoip_data_path)
  country = geoip.country(ip)
  find_by_country_code(country.country_code2)
end