summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-29 00:57:47 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-29 00:57:47 +0000
commit1dd0654b6a9e389ff31fbb34c2250746f636f883 (patch)
tree1effb4a463cd1fd4b5add598de99db817346f93c
parent1ff896075637b8f5c92d29fbdd6afbe7ec7d032e (diff)
* lib/optparse.rb (OptionParser::Switch#conv_arg): unsplat by
Proc#call if no conversion is given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/optparse.rb6
2 files changed, 6 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index a95f9ecf27..1dbdc416e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,10 @@
-Fri Sep 29 09:36:38 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Sep 29 09:56:56 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/extmk.rb: extout is needed for also clean.
fixed: [ruby-core:08944]
- * lib/optparse.rb (parse_in_order): splat arguments to callback block.
+ * lib/optparse.rb (OptionParser::Switch#conv_arg): unsplat by
+ Proc#call if no conversion is given.
Thu Sep 28 23:59:31 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
diff --git a/lib/optparse.rb b/lib/optparse.rb
index cf0791863b..f790054ec2 100644
--- a/lib/optparse.rb
+++ b/lib/optparse.rb
@@ -349,7 +349,7 @@ class OptionParser
if conv
val = conv.call(*val)
else
- val = *val
+ val = proc {|val| val}.call(*val)
end
return arg, block, val
end
@@ -1259,7 +1259,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)
@@ -1290,7 +1290,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)