mirror of
https://github.com/openstreetmap/openstreetmap-website.git
synced 2025-08-20 16:11:02 +00:00
Fix new rubocop warnings
This commit is contained in:
@ -34,13 +34,13 @@ class GeocoderController < ApplicationController
|
|||||||
# We've got two nondescript numbers for a query, which can mean both "lat, lon" or "lon, lat".
|
# We've got two nondescript numbers for a query, which can mean both "lat, lon" or "lon, lat".
|
||||||
@results = []
|
@results = []
|
||||||
|
|
||||||
if lat >= -90 && lat <= 90 && lon >= -180 && lon <= 180
|
if lat.between?(-90, 90) && lon.between?(-180, 180)
|
||||||
@results.push(:lat => params[:lat], :lon => params[:lon],
|
@results.push(:lat => params[:lat], :lon => params[:lon],
|
||||||
:zoom => params[:zoom],
|
:zoom => params[:zoom],
|
||||||
:name => "#{params[:lat]}, #{params[:lon]}")
|
:name => "#{params[:lat]}, #{params[:lon]}")
|
||||||
end
|
end
|
||||||
|
|
||||||
if lon >= -90 && lon <= 90 && lat >= -180 && lat <= 180
|
if lon.between?(-90, 90) && lat.between?(-180, 180)
|
||||||
@results.push(:lat => params[:lon], :lon => params[:lat],
|
@results.push(:lat => params[:lon], :lon => params[:lat],
|
||||||
:zoom => params[:zoom],
|
:zoom => params[:zoom],
|
||||||
:name => "#{params[:lon]}, #{params[:lat]}")
|
:name => "#{params[:lon]}, #{params[:lat]}")
|
||||||
@ -54,10 +54,10 @@ class GeocoderController < ApplicationController
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
# Coordinates in a query have come with markers for latitude and longitude.
|
# Coordinates in a query have come with markers for latitude and longitude.
|
||||||
if lat < -90 || lat > 90
|
if !lat.between?(-90, 90)
|
||||||
@error = "Latitude #{lat} out of range"
|
@error = "Latitude #{lat} out of range"
|
||||||
render :action => "error"
|
render :action => "error"
|
||||||
elsif lon < -180 || lon > 180
|
elsif !lon.between?(-180, 180)
|
||||||
@error = "Longitude #{lon} out of range"
|
@error = "Longitude #{lon} out of range"
|
||||||
render :action => "error"
|
render :action => "error"
|
||||||
else
|
else
|
||||||
|
@ -278,7 +278,7 @@ module ActionController
|
|||||||
|
|
||||||
# Returns true if this paginator contains the page of index +number+.
|
# Returns true if this paginator contains the page of index +number+.
|
||||||
def contains_page?(number)
|
def contains_page?(number)
|
||||||
number >= 1 && number <= page_count
|
number.between?(1, page_count)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns a new Page representing the page with the given index
|
# Returns a new Page representing the page with the given index
|
||||||
|
Reference in New Issue
Block a user