diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-21 05:46:01 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-21 05:46:01 +0000 |
| commit | b3c3e87b70b52296cc04d7b7e6bc565f3730f849 (patch) | |
| tree | c4769be127ab63b9b51f6136414314cc80a01efd | |
| parent | a1bf58a86692b88a51ed2f6511941957dcca0f8f (diff) | |
| download | ruby-b3c3e87b70b52296cc04d7b7e6bc565f3730f849.tar.gz ruby-b3c3e87b70b52296cc04d7b7e6bc565f3730f849.tar.xz ruby-b3c3e87b70b52296cc04d7b7e6bc565f3730f849.zip | |
* lib/optparse.rb (parse_in_order): splat values to be passed.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | lib/optparse.rb | 4 |
2 files changed, 6 insertions, 2 deletions
@@ -1,3 +1,7 @@ +Sun Dec 21 14:45:58 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * lib/optparse.rb (parse_in_order): splat values to be passed. + Sun Dec 21 13:50:37 2008 TAKAO Kouji <kouji@takao7.net> * test/readline/test_readline.rb diff --git a/lib/optparse.rb b/lib/optparse.rb index 134f1cf3b..446039116 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -1263,7 +1263,7 @@ class OptionParser end begin opt, cb, val = sw.parse(rest, argv) {|*exc| raise(*exc)} - val = cb.call(val) if cb + val = cb.call(*val) if cb setter.call(sw.switch_name, val) if setter rescue ParseError raise $!.set_option(arg, rest) @@ -1294,7 +1294,7 @@ class OptionParser opt, cb, 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-*/, '-')) != '-' - val = cb.call(val) if cb + val = cb.call(*val) if cb setter.call(sw.switch_name, val) if setter rescue ParseError raise $!.set_option(arg, arg.length > 2) |
