зеркало из https://github.com/github/ruby.git
Fix default argument values for OptParse::Switch#summarize
The documentation describes these arguments being hashes, and the method is called with hashes, so a hash default makes more sense. The method would fail previously if called without arguments and @short or @long contained a non-integer value. Fixes [Bug #10928]
This commit is contained in:
Родитель
c1ebb384fd
Коммит
3fcffceafd
|
@ -592,7 +592,7 @@ class OptionParser
|
|||
# +max+ columns.
|
||||
# +indent+:: Prefix string indents all summarized lines.
|
||||
#
|
||||
def summarize(sdone = [], ldone = [], width = 1, max = width - 1, indent = "")
|
||||
def summarize(sdone = {}, ldone = {}, width = 1, max = width - 1, indent = "")
|
||||
sopts, lopts = [], [], nil
|
||||
@short.each {|s| sdone.fetch(s) {sopts << s}; sdone[s] = true} if @short
|
||||
@long.each {|s| ldone.fetch(s) {lopts << s}; ldone[s] = true} if @long
|
||||
|
|
Загрузка…
Ссылка в новой задаче