class SyntaxTree::HashLiteral::EmptyWithCommentsFormatter

This is a special formatter used if the hash 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

lbrace[R]
LBrace

the opening brace

Public Class Methods

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

Public Instance Methods

format(q) click to toggle source
# File lib/syntax_tree/node.rb, line 5663
def format(q)
  q.group do
    q.text("{")
    q.indent do
      lbrace.comments.each do |comment|
        q.breakable_force
        comment.format(q)
      end
    end
    q.breakable_force
    q.text("}")
  end
end