summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-08-07 13:00:10 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-08-07 13:00:10 +0000
commite20d6139f40887a05348357753b55867bf5153ad (patch)
treee8e08c033ce67c82797702891530ff296ee93d3e /lib
parent0a85c658591d8b0763423a419dd96a9b957c3918 (diff)
* optparse.rb (OptionParser::Completion::convert): returned all
values not first one. * optparse.rb (OptionParser::Switch::parse): return values as is. * optparse.rb (OptionParser::order): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/optparse.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/optparse.rb b/lib/optparse.rb
index e4f0998fcf..f93000e855 100644
--- a/lib/optparse.rb
+++ b/lib/optparse.rb
@@ -106,7 +106,7 @@ Keyword completion module.
Extracts the first element from result of
((<OptionParser::Completion#complete>)).
=end #'#"#`#
- def convert(opt = nil, *val)
+ def convert(opt = nil, val = nil, *)
val
end
end
@@ -210,8 +210,8 @@ Individual switch class.
=end #'#"#`#
def parse(arg, *val)
if block
- *val = conv.yield(*val) if conv
- return arg, block, *val
+ val = conv.yield(*val) if conv
+ return arg, block, val
else
return arg, nil
end
@@ -1075,8 +1075,8 @@ Default options, which never appear in option summary.
raise $!.set_option(arg, true)
end
begin
- opt, sw, *val = sw.parse(rest, argv) {|*exc| raise(*exc)}
- sw.yield(*val) if sw
+ opt, sw, val = sw.parse(rest, argv) {|*exc| raise(*exc)}
+ sw.yield(val) if sw
rescue ParseError
raise $!.set_option(arg, rest)
end
@@ -1102,10 +1102,10 @@ Default options, which never appear in option summary.
raise $!.set_option(arg, true)
end
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}"
argv.unshift(opt) if opt and (opt = opt.sub(/\A-*/, '-')) != '-'
- sw.yield(*val) if sw
+ sw.yield(val) if sw
rescue ParseError
raise $!.set_option(arg, has_arg)
end