Class: SyntaxTree::ArrayLiteral::QSymbolsFormatter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contents) ⇒ QSymbolsFormatter

Returns a new instance of QSymbolsFormatter.



777
778
779
# File 'lib/syntax_tree/node.rb', line 777

def initialize(contents)
  @contents = contents
end

Instance Attribute Details

#contentsObject (readonly)

Args

the contents of the array



775
776
777
# File 'lib/syntax_tree/node.rb', line 775

def contents
  @contents
end

Instance Method Details

#format(q) ⇒ Object



781
782
783
784
785
786
787
788
789
790
791
# File 'lib/syntax_tree/node.rb', line 781

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