Class: Dap::Filter::FilterGeoIP
- Inherits:
-
Object
- Object
- Dap::Filter::FilterGeoIP
- Includes:
- BaseDecoder, GeoIPLibrary
- Defined in:
- lib/dap/filter/geoip.rb
Overview
Add GeoIP tags using the MaxMind GeoIP::City
Constant Summary
Constants included from GeoIPLibrary
GeoIPLibrary::GEOIP_ASN, GeoIPLibrary::GEOIP_CITY, GeoIPLibrary::GEOIP_DIRS, GeoIPLibrary::GEOIP_ORGS
Instance Attribute Summary
Attributes included from Base
Instance Method Summary collapse
Methods included from BaseDecoder
Methods included from Base
Instance Method Details
#decode(ip) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/dap/filter/geoip.rb', line 51 def decode(ip) unless @@geo_city raise "No MaxMind GeoIP::City data found" end geo_hash = @@geo_city.look_up(ip) return unless geo_hash ret = {} geo_hash.each_pair do |k,v| next unless k ret[k.to_s] = v.to_s end ret end |