summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-25 01:48:41 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-25 01:48:41 +0000
commit429e2abfad7770c90b9f1bed70e5e49c19e37a60 (patch)
tree5db8eabdf536dbc47c5332fbe5762c9ee7b18238 /lib
parentf8fa8dd9de59733315ff96fb8d4f6c3fbace1050 (diff)
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
Diffstat (limited to 'lib')
-rw-r--r--lib/optparse.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/optparse.rb b/lib/optparse.rb
index 05415901a3..7d366a7353 100644
--- a/lib/optparse.rb
+++ b/lib/optparse.rb
@@ -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