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.
4234 4235 4236 4237 |
# File 'lib/syntax_tree/node.rb', line 4234 def initialize(text, node) @text = text @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
- LBrace | Keyword
-
the node that is being represented
4232 4233 4234 |
# File 'lib/syntax_tree/node.rb', line 4232 def node @node end |
#text ⇒ Object (readonly)
- String
-
the actual output that should be printed
4229 4230 4231 |
# File 'lib/syntax_tree/node.rb', line 4229 def text @text end |
Instance Method Details
#comments ⇒ Object
4239 4240 4241 |
# File 'lib/syntax_tree/node.rb', line 4239 def comments node.comments end |
#format(q) ⇒ Object
4243 4244 4245 |
# File 'lib/syntax_tree/node.rb', line 4243 def format(q) q.text(text) end |