Class: SyntaxTree::ArrayLiteral::QSymbolsFormatter
- Inherits:
-
Object
- Object
- SyntaxTree::ArrayLiteral::QSymbolsFormatter
- Defined in:
- lib/syntax_tree.rb
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
- Args
-
the contents of the array.
Instance Method Summary collapse
- #format(q) ⇒ Object
-
#initialize(contents) ⇒ QSymbolsFormatter
constructor
A new instance of QSymbolsFormatter.
Constructor Details
#initialize(contents) ⇒ QSymbolsFormatter
Returns a new instance of QSymbolsFormatter.
1419 1420 1421 |
# File 'lib/syntax_tree.rb', line 1419 def initialize(contents) @contents = contents end |
Instance Attribute Details
#contents ⇒ Object (readonly)
- Args
-
the contents of the array
1417 1418 1419 |
# File 'lib/syntax_tree.rb', line 1417 def contents @contents end |
Instance Method Details
#format(q) ⇒ Object
1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 |
# File 'lib/syntax_tree.rb', line 1423 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 |