Class: SyntaxTree::ArrayLiteral::QSymbolsFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/syntax_tree.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contents) ⇒ QSymbolsFormatter

Returns a new instance of QSymbolsFormatter.



1406
1407
1408
# File 'lib/syntax_tree.rb', line 1406

def initialize(contents)
  @contents = contents
end

Instance Attribute Details

#contentsObject (readonly)

Args

the contents of the array



1404
1405
1406
# File 'lib/syntax_tree.rb', line 1404

def contents
  @contents
end

Instance Method Details

#format(q) ⇒ Object



1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
# File 'lib/syntax_tree.rb', line 1410

def format(q)
  q.group(0, "%i[", "]") do
    q.indent do
      q.breakable("")
      q.seplist(contents.parts, -> { q.breakable }) do |part|
        q.format(part.value)
      end
    end
    q.breakable("")
  end
end