Class: SyntaxTree::ArrayLiteral::EmptyWithCommentsFormatter
- Inherits:
-
Object
- Object
- SyntaxTree::ArrayLiteral::EmptyWithCommentsFormatter
- Defined in:
- lib/syntax_tree/node.rb
Instance Attribute Summary collapse
-
#lbracket ⇒ Object
readonly
- LBracket
-
the opening bracket.
Instance Method Summary collapse
- #format(q) ⇒ Object
-
#initialize(lbracket) ⇒ EmptyWithCommentsFormatter
constructor
A new instance of EmptyWithCommentsFormatter.
Constructor Details
#initialize(lbracket) ⇒ EmptyWithCommentsFormatter
Returns a new instance of EmptyWithCommentsFormatter.
823 824 825 |
# File 'lib/syntax_tree/node.rb', line 823 def initialize(lbracket) @lbracket = lbracket end |
Instance Attribute Details
#lbracket ⇒ Object (readonly)
- LBracket
-
the opening bracket
821 822 823 |
# File 'lib/syntax_tree/node.rb', line 821 def lbracket @lbracket end |
Instance Method Details
#format(q) ⇒ Object
827 828 829 830 831 832 833 834 835 836 837 838 839 |
# File 'lib/syntax_tree/node.rb', line 827 def format(q) q.group do q.text("[") q.indent do lbracket.comments.each do |comment| q.breakable(force: true) comment.format(q) end end q.breakable(force: true) q.text("]") end end |