* lib/optparse.rb (OptionParser::Switch::parse,
OptionParser::order): use {Block,Proc}#call instead of deprecated #yield. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b4fd4d6018
commit
6e242d868e
@ -1,3 +1,9 @@
|
|||||||
|
Mon May 26 21:21:20 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||||
|
|
||||||
|
* lib/optparse.rb (OptionParser::Switch::parse,
|
||||||
|
OptionParser::order): use {Block,Proc}#call instead of deprecated
|
||||||
|
#yield.
|
||||||
|
|
||||||
Mon May 26 16:39:10 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Mon May 26 16:39:10 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (Init_Proc): Block/Proc separation. [huge change]
|
* eval.c (Init_Proc): Block/Proc separation. [huge change]
|
||||||
|
@ -222,7 +222,7 @@ Individual switch class.
|
|||||||
=end #'#"#`#
|
=end #'#"#`#
|
||||||
def parse(arg, *val)
|
def parse(arg, *val)
|
||||||
if block
|
if block
|
||||||
val = conv.yield(*val) if conv
|
val = conv.call(*val) if conv
|
||||||
return arg, block, val
|
return arg, block, val
|
||||||
else
|
else
|
||||||
return arg, nil
|
return arg, nil
|
||||||
@ -1117,7 +1117,7 @@ Default options, which never appear in option summary.
|
|||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
opt, sw, val = sw.parse(rest, argv) {|*exc| raise(*exc)}
|
opt, sw, val = sw.parse(rest, argv) {|*exc| raise(*exc)}
|
||||||
sw.yield(val) if sw
|
sw.call(val) if sw
|
||||||
rescue ParseError
|
rescue ParseError
|
||||||
raise $!.set_option(arg, rest)
|
raise $!.set_option(arg, rest)
|
||||||
end
|
end
|
||||||
@ -1146,7 +1146,7 @@ Default options, which never appear in option summary.
|
|||||||
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}"
|
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-*/, '-')) != '-'
|
||||||
sw.yield(val) if sw
|
sw.call(val) if sw
|
||||||
rescue ParseError
|
rescue ParseError
|
||||||
raise $!.set_option(arg, has_arg)
|
raise $!.set_option(arg, has_arg)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user