summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-10 00:20:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-10 00:20:03 +0000
commit1755b98599f3b7768972a8cfbc4f80f4c22bc0ea (patch)
tree11e7e6e9cebef2b6602258b2338a6e593ae3034d
parent7c647031ba33abe7a4e862f9a488a0cb71e023ba (diff)
downloadruby-1755b98599f3b7768972a8cfbc4f80f4c22bc0ea.tar.gz
ruby-1755b98599f3b7768972a8cfbc4f80f4c22bc0ea.tar.xz
ruby-1755b98599f3b7768972a8cfbc4f80f4c22bc0ea.zip
* lib/optparse.rb: splat parsed arguments.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@10904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--lib/optparse.rb10
2 files changed, 9 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 351b1d18a..d993b0eea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sun Sep 10 09:19:47 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb: splat parsed arguments.
+
Tue Jan 10 09:18:03 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (rb_require_safe): prevent extension from loading twice.
diff --git a/lib/optparse.rb b/lib/optparse.rb
index 305f828e0..e24d77e4e 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