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.
4248 4249 4250 4251 |
# File 'lib/syntax_tree/node.rb', line 4248 def initialize(text, node) @text = text @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
- LBrace | Keyword
-
the node that is being represented
4246 4247 4248 |
# File 'lib/syntax_tree/node.rb', line 4246 def node @node end |
#text ⇒ Object (readonly)
- String
-
the actual output that should be printed
4243 4244 4245 |
# File 'lib/syntax_tree/node.rb', line 4243 def text @text end |
Instance Method Details
#comments ⇒ Object
4253 4254 4255 |
# File 'lib/syntax_tree/node.rb', line 4253 def comments node.comments end |
#format(q) ⇒ Object
4257 4258 4259 |
# File 'lib/syntax_tree/node.rb', line 4257 def format(q) q.text(text) end |