1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2003-05-29 21:35:50 +00:00
parent f130d47f6a
commit 4ca5e66ee7

View file

@ -223,7 +223,7 @@ Individual switch class.
def parse(arg, *val) def parse(arg, *val)
if block if block
val = conv.call(*val) if conv val = conv.call(*val) if conv
return arg, block, *val return arg, block, val
else else
return arg, nil return arg, nil
end end
@ -1122,8 +1122,8 @@ Default options, which never appear in option summary.
raise $!.set_option(arg, true) raise $!.set_option(arg, true)
end end
begin begin
opt, sw, *val = sw.parse(rest, argv) {|*exc| raise(*exc)} opt, sw, val = sw.parse(rest, argv) {|*exc| raise(*exc)}
sw.call(*val) if sw sw.call(val) if sw
rescue ParseError rescue ParseError
raise $!.set_option(arg, rest) raise $!.set_option(arg, rest)
end end
@ -1149,10 +1149,10 @@ Default options, which never appear in option summary.
raise $!.set_option(arg, true) raise $!.set_option(arg, true)
end end
begin begin
opt, sw, *val = sw.parse(val, argv) {|*exc| raise(*exc) if eq} opt, sw, val = sw.parse(val, argv) {|*exc| raise(*exc) if eq}
raise InvalidOption, arg if has_arg and !eq and arg == "-#{opt}" raise InvalidOption, arg if has_arg and !eq and arg == "-#{opt}"
argv.unshift(opt) if opt and (opt = opt.sub(/\A-*/, '-')) != '-' argv.unshift(opt) if opt and (opt = opt.sub(/\A-*/, '-')) != '-'
sw.call(*val) if sw sw.call(val) if sw
rescue ParseError rescue ParseError
raise $!.set_option(arg, has_arg) raise $!.set_option(arg, has_arg)
end end