End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
OptionParser#notwice
notwice(obj, prv, msg)
lib/optparse.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/optparse.rb, line 1303
def notwice(obj, prv, msg)
unless !prv or prv == obj
raise(ArgumentError, "argument #{msg} given twice: #{obj}",
ParseError.filter_backtrace(caller(2)))
end
obj
end
Checks if an argument is given twice, in which case an ArgumentError is raised. Called from OptionParser#switch only.
obj-
New argument.
prv-
Previously specified argument.
msg-
Exceptionmessage.