mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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/trunk@11049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d5195959bf
commit
60a289741c
2 changed files with 6 additions and 5 deletions
|
@ -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.
|
* ext/extmk.rb: extout is needed for also clean.
|
||||||
fixed: [ruby-core:08944]
|
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>
|
Thu Sep 28 23:59:31 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
|
|
@ -349,7 +349,7 @@ class OptionParser
|
||||||
if conv
|
if conv
|
||||||
val = conv.call(*val)
|
val = conv.call(*val)
|
||||||
else
|
else
|
||||||
val = *val
|
val = proc {|val| val}.call(*val)
|
||||||
end
|
end
|
||||||
return arg, block, val
|
return arg, block, val
|
||||||
end
|
end
|
||||||
|
@ -1259,7 +1259,7 @@ class OptionParser
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
opt, cb, val = sw.parse(rest, argv) {|*exc| raise(*exc)}
|
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
|
setter.call(sw.switch_name, val) if setter
|
||||||
rescue ParseError
|
rescue ParseError
|
||||||
raise $!.set_option(arg, rest)
|
raise $!.set_option(arg, rest)
|
||||||
|
@ -1290,7 +1290,7 @@ class OptionParser
|
||||||
opt, cb, val = sw.parse(val, argv) {|*exc| raise(*exc) if eq}
|
opt, cb, val = sw.parse(val, argv) {|*exc| raise(*exc) if eq}
|
||||||
raise InvalidOption, arg if has_arg and !eq and arg == "-#{opt}"
|
raise InvalidOption, arg if has_arg and !eq and arg == "-#{opt}"
|
||||||
argv.unshift(opt) if opt and (opt = opt.sub(/\A-*/, '-')) != '-'
|
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
|
setter.call(sw.switch_name, val) if setter
|
||||||
rescue ParseError
|
rescue ParseError
|
||||||
raise $!.set_option(arg, arg.length > 2)
|
raise $!.set_option(arg, arg.length > 2)
|
||||||
|
|
Loading…
Add table
Reference in a new issue