mirror of
https://github.com/ruby/ruby.git
synced 2025-08-16 05:59:00 +02:00
* lib/optparse.rb (parse_in_order): splat arguments to callback block.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5fc73f7ea4
commit
0d94606158
2 changed files with 6 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue