From: Anton Khorev Date: Sat, 13 Jul 2024 13:00:45 +0000 (+0300) Subject: Use casecmp?() instead of casecmp().zero? X-Git-Tag: live~318^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/a082caef3cb03179a7018fa43ee5d278bd5fccf3 Use casecmp?() instead of casecmp().zero? --- diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 05fa76658..c6223fb9d 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -181,7 +181,7 @@ class ApplicationController < ActionController::Base # TODO: some sort of escaping of problem characters in the message response.headers["Error"] = message - if request.headers["X-Error-Format"]&.casecmp("xml")&.zero? + if request.headers["X-Error-Format"]&.casecmp?("xml") result = OSM::API.new.xml_doc result.root.name = "osmError" result.root << (XML::Node.new("status") << "#{Rack::Utils.status_code(status)} #{Rack::Utils::HTTP_STATUS_CODES[status]}") diff --git a/app/controllers/geocoder_controller.rb b/app/controllers/geocoder_controller.rb index 312762216..ca6bab6df 100644 --- a/app/controllers/geocoder_controller.rb +++ b/app/controllers/geocoder_controller.rb @@ -225,12 +225,12 @@ class GeocoderController < ApplicationController end def to_decdeg(captures) - ns = captures.fetch("ns").casecmp("s").zero? ? -1 : 1 + ns = captures.fetch("ns").casecmp?("s") ? -1 : 1 nsd = BigDecimal(captures.fetch("nsd", "0")) nsm = BigDecimal(captures.fetch("nsm", "0")) nss = BigDecimal(captures.fetch("nss", "0")) - ew = captures.fetch("ew").casecmp("w").zero? ? -1 : 1 + ew = captures.fetch("ew").casecmp?("w") ? -1 : 1 ewd = BigDecimal(captures.fetch("ewd", "0")) ewm = BigDecimal(captures.fetch("ewm", "0")) ews = BigDecimal(captures.fetch("ews", "0")) diff --git a/app/models/request_token.rb b/app/models/request_token.rb index adeabb184..ec38f7421 100644 --- a/app/models/request_token.rb +++ b/app/models/request_token.rb @@ -73,7 +73,7 @@ class RequestToken < OauthToken end def oob? - callback_url.nil? || callback_url.casecmp("oob").zero? + callback_url.nil? || callback_url.casecmp?("oob") end def oauth10?