summaryrefslogtreecommitdiff
path: root/lib/optparse.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/optparse.rb')
-rw-r--r--lib/optparse.rb2
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]