lib/geocoder/lookups/freegeoip.rb in geocoder-0.9.10 vs lib/geocoder/lookups/freegeoip.rb in geocoder-0.9.11
- old
+ new
@@ -4,18 +4,16 @@
module Geocoder::Lookup
class Freegeoip < Base
private # ---------------------------------------------------------------
- def result(query, reverse = false)
+ def results(query, reverse = false)
# don't look up a loopback address, just return the stored result
- return reserved_result(query) if loopback_address?(query)
+ return [reserved_result(query)] if loopback_address?(query)
begin
- if doc = fetch_data(query, reverse)
- doc
- end
+ return [fetch_data(query, reverse)]
rescue StandardError # Freegeoip.net returns HTML on bad request
- nil
+ return []
end
end
def reserved_result(ip)
{