diff options
author | Nobuyoshi Nakada <[email protected]> | 2025-03-10 17:02:43 +0900 |
---|---|---|
committer | git <[email protected]> | 2025-03-10 08:03:55 +0000 |
commit | b51450f3bd77f6dc862fcb8b177922a588f0e381 (patch) | |
tree | 720f2f1a52d5a37888b48915f8fe48d200be51e9 | |
parent | dad0f876a9d25c8772b0c7ffbfd8e163569f0141 (diff) |
[ruby/optparse] Update argument check with save navigation operator
https://github.com/ruby/optparse/commit/71e2b31824
-rw-r--r-- | lib/optparse.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/optparse.rb b/lib/optparse.rb index a53b1d16ee..a45d99d293 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -780,7 +780,7 @@ class OptionParser # Returns nil if argument is not present or begins with '-' and is not '-'. # def parse(arg, argv, &error) - if !(val = arg) and (argv.empty? or /\A-./ =~ (val = argv[0])) + if !(val = arg) and !(val = argv[0])&.match?(/\A(?!-.)/) return nil, block end opt = (val = parse_arg(val, &error))[1] |