Class: GeoipRedis::Resolver
- Inherits:
-
Object
- Object
- GeoipRedis::Resolver
- Defined in:
- lib/geoip_redis/resolver.rb
Instance Method Summary collapse
-
#initialize(redis) ⇒ Resolver
constructor
A new instance of Resolver.
- #resolve(ip) ⇒ Object
Constructor Details
Instance Method Details
#resolve(ip) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/geoip_redis/resolver.rb', line 11 def resolve(ip) ip_num = normalize_ip(ip).to_i ip_range = @store.find_ip_range(ip_num) return if ip_range.nil? || !ip_range.member?(ip_num) @store.find_location(ip_range.location_id) end |