X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/95d899786a1bbabacc0cd12ef1c4814118d9d0de..6ffee1cf4be9b90bd8e807805ad59371c343de0d:/lib/osm.rb?ds=inline diff --git a/lib/osm.rb b/lib/osm.rb index 02c51df78..dd62d6620 100644 --- a/lib/osm.rb +++ b/lib/osm.rb @@ -9,6 +9,13 @@ module OSM require 'RMagick' require 'nokogiri' + if defined?(SystemTimer) + Timer = SystemTimer + else + require 'timeout' + Timer = Timeout + end + # The base class for API Errors. class APIError < RuntimeError def status @@ -448,7 +455,7 @@ module OSM end def self.IPToCountry(ip_address) - Timeout::timeout(4) do + Timer.timeout(4) do ipinfo = Quova::IpInfo.new(ip_address) if ipinfo.status == Quova::Success then