diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-05 13:27:48 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-05 13:27:48 +0000 |
commit | 40ae6aaa1372aea4235ebaa4d896e1207015b517 (patch) | |
tree | 81b4d726b3ee9e06afa2f0781dfbad263c62dbff /lib/prettyprint.rb | |
parent | ad3b5a7ffe37a989d19ac902c46ecd81c66b0d7b (diff) | |
download | ruby-40ae6aaa1372aea4235ebaa4d896e1207015b517.tar.gz |
* lib/pp.rb: Use frozen_string_literal: true.
* lib/prettyprint.rb: Ditto.
* lib/resolv.rb: Ditto.
* lib/tmpdir.rb: Ditto.
* test/test_pp.rb: Ditto.
* test/test_prettyprint.rb: Ditto.
* tool/transcode-tblgen.rb: Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/prettyprint.rb')
-rw-r--r-- | lib/prettyprint.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/prettyprint.rb b/lib/prettyprint.rb index 7e989374b7..dc63e49321 100644 --- a/lib/prettyprint.rb +++ b/lib/prettyprint.rb @@ -1,3 +1,5 @@ +# -*- frozen_string_literal: true -*- +# # This class implements a pretty printing algorithm. It finds line breaks and # nice indentations for grouped structure. # @@ -40,7 +42,7 @@ class PrettyPrint # output # end # - def PrettyPrint.format(output='', maxwidth=79, newline="\n", genspace=lambda {|n| ' ' * n}) + def PrettyPrint.format(output=''.dup, maxwidth=79, newline="\n", genspace=lambda {|n| ' ' * n}) q = PrettyPrint.new(output, maxwidth, newline, &genspace) yield q q.flush @@ -54,7 +56,7 @@ class PrettyPrint # The invocation of +breakable+ in the block doesn't break a line and is # treated as just an invocation of +text+. # - def PrettyPrint.singleline_format(output='', maxwidth=nil, newline=nil, genspace=nil) + def PrettyPrint.singleline_format(output=''.dup, maxwidth=nil, newline=nil, genspace=nil) q = SingleLine.new(output) yield q output @@ -77,7 +79,7 @@ class PrettyPrint # The block is used to generate spaces. {|width| ' ' * width} is used if it # is not given. # - def initialize(output='', maxwidth=79, newline="\n", &genspace) + def initialize(output=''.dup, maxwidth=79, newline="\n", &genspace) @output = output @maxwidth = maxwidth @newline = newline |