From 3fcffceafd2bce7186851bf4899484c545a9ace8 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Sun, 7 Jul 2019 10:49:53 -0700 Subject: [PATCH] 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] --- lib/optparse.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/optparse.rb b/lib/optparse.rb index 9937e2500d..25e262a69a 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -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