ruby-changes:49917
From: nobu <ko1@a...>
Date: Thu, 25 Jan 2018 10:48:46 +0900 (JST)
Subject: [ruby-changes:49917] nobu:r62035 (trunk): optparse.rb: literal newline
nobu 2018-01-25 10:48:41 +0900 (Thu, 25 Jan 2018) New Revision: 62035 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62035 Log: 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 $/. Modified files: trunk/lib/optparse.rb Index: lib/optparse.rb =================================================================== --- lib/optparse.rb (revision 62034) +++ lib/optparse.rb (revision 62035) @@ -1237,7 +1237,8 @@ XXX https://github.com/ruby/ruby/blob/trunk/lib/optparse.rb#L1237 # +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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/