X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/d326007c73160f8ca80cd6e81356e886e1ff2f5e..307adfed3045a1673b09bccce74acaaf530d3c9b:/cookbooks/tile/files/default/ruby/expire.rb diff --git a/cookbooks/tile/files/default/ruby/expire.rb b/cookbooks/tile/files/default/ruby/expire.rb index d695a0bc5..3d693ad5b 100755 --- a/cookbooks/tile/files/default/ruby/expire.rb +++ b/cookbooks/tile/files/default/ruby/expire.rb @@ -18,9 +18,9 @@ module Expire # the size of the meta tile blocks METATILE = 8 # the directory root for meta tiles - HASH_ROOT = "/tiles/default/" + HASH_ROOT = "/tiles/default/".freeze # node cache file - NODE_CACHE_FILE = "/store/database/nodes" + NODE_CACHE_FILE = "/store/database/nodes".freeze # turns a spherical mercator coord into a tile coord def self.tile_from_merc(point, zoom) @@ -103,12 +103,8 @@ module Expire # added, deleted or modified - the tile will need updating anyway. doc.find("//node").each do |node| lat = node["lat"].to_f - if lat < -85 - lat = -85 - end - if lat > 85 - lat = 85 - end + lat = -85 if lat < -85 + lat = 85 if lat > 85 point = Proj4::Point.new(Math::PI * node["lon"].to_f / 180, Math::PI * lat / 180) nodes[node["id"].to_i] = tile_from_latlon(point, max_zoom) @@ -143,7 +139,7 @@ module Expire set = Set.new nodes.values # expire tiles and shrink to the set of parents - (max_zoom).downto(min_zoom) do |_| + max_zoom.downto(min_zoom) do |_| # allow the block to work on the set, returning the set at the next # zoom level set = yield set @@ -186,9 +182,7 @@ module Expire lon, lat = @cache.sysread(8).unpack("ll") - if lon != -2147483648 && lat != -2147483648 - node = Node.new(lon, lat) - end + node = Node.new(lon, lat) if lon != -2147483648 && lat != -2147483648 end node