diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2026-04-05 13:55:32 +0900 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2026-04-06 09:49:15 +0000 |
| commit | 53b5f9ea09c482b7aca3ce6538695f94bbbf8822 (patch) | |
| tree | 9ae3cd9cd2702f738d9c68fe4a4e1fec2efb6f5d | |
| parent | eebd2f7d76554a6f4a63e69007aece8bb5dda55b (diff) | |
[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
| -rw-r--r-- | lib/resolv.rb | 3 |
1 files changed, 1 insertions, 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") |
