method
update
ruby latest stable - Class:
List
Method deprecated or moved
This method is deprecated or moved on the latest stable version. The last existing version (v1_8_7_330) is shown here.
update(sw, sopts, lopts, nsw = nil, nlopts = nil)private
Adds sw according to sopts, lopts and nlopts.
sw
OptionParser::Switch instance to be added.
sopts
Short style option list.
lopts
Long style option list.
nlopts
Negated long style options list.
# File lib/optparse.rb, line 557
def update(sw, sopts, lopts, nsw = nil, nlopts = nil)
o = nil
sopts.each {|o| @short[o] = sw} if sopts
lopts.each {|o| @long[o] = sw} if lopts
nlopts.each {|o| @long[o] = nsw} if nsw and nlopts
used = @short.invert.update(@long.invert)
@list.delete_if {|o| Switch === o and !used[o]}
end