Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 00d29aa

Browse files
eileencodeskddnewton
authored andcommitted
remove newline/default_newline
1 parent 7d44043 commit 00d29aa

File tree

1 file changed

+5
-28
lines changed

1 file changed

+5
-28
lines changed

lib/syntax_tree/prism/prettier_print.rb

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,6 @@ def self.for(output)
271271
end
272272
end
273273

274-
# When printing, you can optionally specify the value that should be used
275-
# whenever a group needs to be broken onto multiple lines. In this case the
276-
# default is \n.
277-
DEFAULT_NEWLINE = "\n"
278-
279274
# There are two modes in printing, break and flat. When we're in break mode,
280275
# any lines will use their newline, any if-breaks will use their break
281276
# contents, etc.
@@ -303,10 +298,9 @@ def self.for(output)
303298
def self.format(
304299
output = "".dup,
305300
maxwidth = 80,
306-
newline = DEFAULT_NEWLINE,
307301
indentation = DEFAULT_INDENTATION
308302
)
309-
q = new(output, maxwidth, newline)
303+
q = new(output, maxwidth)
310304
yield q
311305
q.flush(indentation)
312306
output
@@ -329,11 +323,6 @@ def self.format(
329323
# This defaults to 80, and should be an Integer
330324
attr_reader :maxwidth
331325

332-
# The value that is appended to +output+ to add a new line.
333-
#
334-
# This defaults to "\n", and should be String
335-
attr_reader :newline
336-
337326
# The stack of groups that are being printed.
338327
attr_reader :groups
339328

@@ -346,26 +335,18 @@ def self.format(
346335
# +output+ is an output target. If it is not specified, '' is assumed. It
347336
# should have a << method which accepts the first argument +obj+ of
348337
# PrettierPrint#text, the first argument +separator+ of PrettierPrint#breakable,
349-
# the first argument +newline+ of PrettierPrint.new, and the result of a given
350-
# block for PrettierPrint.new.
338+
# and the result of a given block for PrettierPrint.new.
351339
#
352340
# +maxwidth+ specifies maximum line length. If it is not specified, 80 is
353341
# assumed. However actual outputs may overflow +maxwidth+ if long
354342
# non-breakable texts are provided.
355343
#
356-
# +newline+ is used for line breaks. "\n" is used if it is not specified.
357-
#
358344
# The block is used to generate spaces. ->(n) { ' ' * n } is used if it is not
359345
# given.
360-
def initialize(
361-
output = "".dup,
362-
maxwidth = 80,
363-
newline = DEFAULT_NEWLINE
364-
)
346+
def initialize(output = "".dup, maxwidth = 80)
365347
@output = output
366348
@buffer = Buffer.for(output)
367349
@maxwidth = maxwidth
368-
@newline = newline
369350
reset
370351
end
371352

@@ -378,16 +359,12 @@ def initialize(
378359
# => #<PrettierPrint:0x0>
379360
# q.group {
380361
# q.text q.current_group.inspect
381-
# q.text q.newline
382362
# q.group(q.current_group.depth + 1) {
383363
# q.text q.current_group.inspect
384-
# q.text q.newline
385364
# q.group(q.current_group.depth + 1) {
386365
# q.text q.current_group.inspect
387-
# q.text q.newline
388366
# q.group(q.current_group.depth + 1) {
389367
# q.text q.current_group.inspect
390-
# q.text q.newline
391368
# }
392369
# }
393370
# }
@@ -492,11 +469,11 @@ def flush(base_indentation = DEFAULT_INDENTATION)
492469
end
493470

494471
if !doc.indent?
495-
buffer << newline
472+
buffer << "\n"
496473
position = 0
497474
else
498475
position -= buffer.trim!
499-
buffer << newline
476+
buffer << "\n"
500477
buffer << " " * indent
501478
position = indent
502479
end

0 commit comments

Comments
 (0)