diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-09-10 00:20:03 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-09-10 00:20:03 +0000 |
commit | 166ee9719f323f7337124eb6288181d128fd4806 (patch) | |
tree | 11e7e6e9cebef2b6602258b2338a6e593ae3034d /lib | |
parent | 36e79167ab7a763a0733eec7c69689bce9417afd (diff) | |
download | ruby-166ee9719f323f7337124eb6288181d128fd4806.tar.gz |
* lib/optparse.rb: splat parsed arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/optparse.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/optparse.rb b/lib/optparse.rb index 305f828e0e..e24d77e4e3 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -1250,8 +1250,8 @@ class OptionParser raise $!.set_option(arg, true) end begin - opt, sw, val = sw.parse(rest, argv) {|*exc| raise(*exc)} - sw.call(val) if sw + opt, sw, *val = sw.parse(rest, argv) {|*exc| raise(*exc)} + sw.call(*val) if sw rescue ParseError raise $!.set_option(arg, rest) end @@ -1278,10 +1278,10 @@ class OptionParser 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.call(val) if sw + sw.call(*val) if sw rescue ParseError raise $!.set_option(arg, arg.length > 2) end @@ -1300,7 +1300,7 @@ class OptionParser nil } - visit(:search, :short, nil) {|sw| sw.block.call(argv) if !sw.pattern} + visit(:search, :short, nil) {|sw| sw.block.call(*argv) if !sw.pattern} argv end |