1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

optparse.rb: literal newline

* lib/optparse.rb (OptionParser#summarize): use literal newline to
  join option summaries as IO#puts does, not the special gloval
  variable $/.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-01-25 01:48:41 +00:00
parent f8fa8dd9de
commit 429e2abfad

View file

@ -1237,7 +1237,8 @@ XXX
# +indent+:: Indentation, defaults to @summary_indent.
#
def summarize(to = [], width = @summary_width, max = width - 1, indent = @summary_indent, &blk)
blk ||= proc {|l| to << (l.index($/, -1) ? l : l + $/)}
nl = "\n"
blk ||= proc {|l| to << (l.index(nl, -1) ? l : l + nl)}
visit(:summarize, {}, {}, width, max, indent, &blk)
to
end