Class: SyntaxTree::BlockNode::BlockOpenFormatter
- Inherits:
-
Object
- Object
- SyntaxTree::BlockNode::BlockOpenFormatter
- Defined in:
- lib/syntax_tree/node.rb
Overview
Formats the opening brace or keyword of a block.
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
- LBrace | Keyword
-
the node that is being represented.
-
#text ⇒ Object
readonly
- String
-
the actual output that should be printed.
Instance Method Summary collapse
- #comments ⇒ Object
- #format(q) ⇒ Object
-
#initialize(text, node) ⇒ BlockOpenFormatter
constructor
A new instance of BlockOpenFormatter.
Constructor Details
#initialize(text, node) ⇒ BlockOpenFormatter
Returns a new instance of BlockOpenFormatter.
4321 4322 4323 4324 |
# File 'lib/syntax_tree/node.rb', line 4321 def initialize(text, node) @text = text @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
- LBrace | Keyword
-
the node that is being represented
4319 4320 4321 |
# File 'lib/syntax_tree/node.rb', line 4319 def node @node end |
#text ⇒ Object (readonly)
- String
-
the actual output that should be printed
4316 4317 4318 |
# File 'lib/syntax_tree/node.rb', line 4316 def text @text end |
Instance Method Details
#comments ⇒ Object
4326 4327 4328 |
# File 'lib/syntax_tree/node.rb', line 4326 def comments node.comments end |
#format(q) ⇒ Object
4330 4331 4332 |
# File 'lib/syntax_tree/node.rb', line 4330 def format(q) q.text(text) end |