Class: GeoipRedis::BlocksParser

Inherits:
Object
  • Object
show all
Defined in:
lib/geoip_redis/blocks_parser.rb

Instance Method Summary collapse

Instance Method Details

#ip_range(data) ⇒ Object



10
11
12
13
14
# File 'lib/geoip_redis/blocks_parser.rb', line 10

def ip_range(data)
  location_id = data[GEONAME_ID]
  cidr = data[CIDR]
  IpRange.build_from_network(cidr, location_id)
end

#location(data) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/geoip_redis/blocks_parser.rb', line 21

def location(data)
  {
    location_id: data[GEONAME_ID],
    postal_code: data[POSTAL_CODE],
    latitude:    data[LATITUDE],
    longitude:   data[LONGITUDE],
  }
end