X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/dc2a2c8ebd1a11e4a64555fda22c6859a51defff..67f365843186c4a2214b5d4bcfae47d59aa86309:/lib/short_link.rb diff --git a/lib/short_link.rb b/lib/short_link.rb index 69634cea5..43d64041e 100644 --- a/lib/short_link.rb +++ b/lib/short_link.rb @@ -22,7 +22,7 @@ module ShortLink # keep support for old shortlinks which use the @ character, now # replaced by the ~ character because twitter is horribly broken # and we can't have that. - str.gsub!("@", "~") + str.tr!("@", "~") str.each_char do |c| t = ARRAY.index c @@ -55,7 +55,7 @@ module ShortLink # given a location and zoom, return a short string representing it. def self.encode(lon, lat, z) code = interleave_bits(((lon + 180.0) * 2**32 / 360.0).to_i, - ((lat + 90.0) * 2**32 / 180.0).to_i) + ((lat + 90.0) * 2**32 / 180.0).to_i) str = "" # add eight to the zoom level, which approximates an accuracy of # one pixel in a tile.