Class: SyntaxTree::HashLiteral::EmptyWithCommentsFormatter
- Inherits:
-
Object
- Object
- SyntaxTree::HashLiteral::EmptyWithCommentsFormatter
- Defined in:
- lib/syntax_tree/node.rb
Instance Attribute Summary collapse
-
#lbrace ⇒ Object
readonly
- LBrace
-
the opening brace.
Instance Method Summary collapse
- #format(q) ⇒ Object
-
#initialize(lbrace) ⇒ EmptyWithCommentsFormatter
constructor
A new instance of EmptyWithCommentsFormatter.
Constructor Details
#initialize(lbrace) ⇒ EmptyWithCommentsFormatter
Returns a new instance of EmptyWithCommentsFormatter.
4629 4630 4631 |
# File 'lib/syntax_tree/node.rb', line 4629 def initialize(lbrace) @lbrace = lbrace end |
Instance Attribute Details
#lbrace ⇒ Object (readonly)
- LBrace
-
the opening brace
4627 4628 4629 |
# File 'lib/syntax_tree/node.rb', line 4627 def lbrace @lbrace end |
Instance Method Details
#format(q) ⇒ Object
4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 |
# File 'lib/syntax_tree/node.rb', line 4633 def format(q) q.group do q.text("{") q.indent do lbrace.comments.each do |comment| q.breakable(force: true) comment.format(q) end end q.breakable(force: true) q.text("}") end end |