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.
4336 4337 4338 4339 |
# File 'lib/syntax_tree/node.rb', line 4336 def initialize(text, node) @text = text @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
- LBrace | Keyword
-
the node that is being represented
4334 4335 4336 |
# File 'lib/syntax_tree/node.rb', line 4334 def node @node end |
#text ⇒ Object (readonly)
- String
-
the actual output that should be printed
4331 4332 4333 |
# File 'lib/syntax_tree/node.rb', line 4331 def text @text end |
Instance Method Details
#comments ⇒ Object
4341 4342 4343 |
# File 'lib/syntax_tree/node.rb', line 4341 def comments node.comments end |
#format(q) ⇒ Object
4345 4346 4347 |
# File 'lib/syntax_tree/node.rb', line 4345 def format(q) q.text(text) end |