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.



1364
1365
1366
# File 'lib/syntax_tree.rb', line 1364

def initialize(contents)
  @contents = contents
end

Instance Attribute Details

#contentsObject (readonly)

Args

the contents of the array



1362
1363
1364
# File 'lib/syntax_tree.rb', line 1362

def contents
  @contents
end

Instance Method Details

#format(q) ⇒ Object



1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
# File 'lib/syntax_tree.rb', line 1368

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
  end
end