Skip to content

Commit b51450f

Browse files
nobumatzbot
authored andcommitted
[ruby/optparse] Update argument check with save navigation operator
ruby/optparse@71e2b31824
1 parent dad0f87 commit b51450f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/optparse.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ class PlacedArgument < self
780780
# Returns nil if argument is not present or begins with '-' and is not '-'.
781781
#
782782
def parse(arg, argv, &error)
783-
if !(val = arg) and (argv.empty? or /\A-./ =~ (val = argv[0]))
783+
if !(val = arg) and !(val = argv[0])&.match?(/\A(?!-.)/)
784784
return nil, block
785785
end
786786
opt = (val = parse_arg(val, &error))[1]

0 commit comments

Comments
 (0)