From 53b5f9ea09c482b7aca3ce6538695f94bbbf8822 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 5 Apr 2026 13:55:32 +0900 Subject: [ruby/resolv] Use `Regexp#match` to achieve matched data This method is available since ruby 1.9.0. https://github.com/ruby/resolv/commit/1e05d06fbd --- lib/resolv.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/resolv.rb b/lib/resolv.rb index a031614732..6109278ede 100644 --- a/lib/resolv.rb +++ b/lib/resolv.rb @@ -3344,10 +3344,9 @@ class Resolv when Coord return arg when String - unless Regex =~ arg && $1.to_f < 180 + unless (m = Regex.match(arg)) && m[1].to_i < 180 raise ArgumentError.new("not a properly formed Coord string: " + arg) end - m = $~ hemi = (m[4][/[NE]/]) || (m[4][/[SW]/]) ? 1 : -1 coordinates = [ ((m[1].to_i*(36e5)) + (m[2].to_i*(6e4)) + (m[3].to_f*(1e3))) * hemi+(2**31) ].pack("N") -- cgit v1.2.3