class SyntaxTree::ArrayLiteral::EmptyWithCommentsFormatter

This is a special formatter used if the array literal contains no values but does contain comments. In this case we do some special formatting to make sure the comments gets indented properly.

Attributes

lbracket[R]
LBracket

the opening bracket

Public Class Methods

new(lbracket) click to toggle source
# File lib/syntax_tree/node.rb, line 1124
def initialize(lbracket)
  @lbracket = lbracket
end

Public Instance Methods

format(q) click to toggle source
# File lib/syntax_tree/node.rb, line 1128
def format(q)
  q.group do
    q.text("[")
    q.indent do
      lbracket.comments.each do |comment|
        q.breakable_force
        comment.format(q)
      end
    end
    q.breakable_force
    q.text("]")
  end
end