Class: SyntaxTree::ArrayLiteral
- Inherits:
-
Object
- Object
- SyntaxTree::ArrayLiteral
- Defined in:
- lib/syntax_tree/node.rb
Instance Method Summary collapse
Instance Method Details
#format(q) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/syntax_tree/node.rb', line 5 def format(q) lbracket = self.lbracket contents = self.contents # deleted formatting bracket array to percent array if empty_with_comments? EmptyWithCommentsFormatter.new(lbracket).format(q) return end q.group do q.format(lbracket) if contents q.indent do q.breakable_empty q.format(contents) q.if_break { q.text(",") } if q.trailing_comma? end end q.breakable_empty q.text("]") end end |