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.
4300 4301 4302 4303 |
# File 'lib/syntax_tree/node.rb', line 4300 def initialize(text, node) @text = text @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
- LBrace | Keyword
-
the node that is being represented
4298 4299 4300 |
# File 'lib/syntax_tree/node.rb', line 4298 def node @node end |
#text ⇒ Object (readonly)
- String
-
the actual output that should be printed
4295 4296 4297 |
# File 'lib/syntax_tree/node.rb', line 4295 def text @text end |
Instance Method Details
#comments ⇒ Object
4305 4306 4307 |
# File 'lib/syntax_tree/node.rb', line 4305 def comments node.comments end |
#format(q) ⇒ Object
4309 4310 4311 |
# File 'lib/syntax_tree/node.rb', line 4309 def format(q) q.text(text) end |