Class: SyntaxTree::BlockFormatter::BlockOpenFormatter
- Inherits:
-
Object
- Object
- SyntaxTree::BlockFormatter::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
1970 1971 1972 1973 |
# File 'lib/syntax_tree/node.rb', line 1970 def initialize(text, node) @text = text @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
- LBrace | Keyword
-
the node that is being represented
1968 1969 1970 |
# File 'lib/syntax_tree/node.rb', line 1968 def node @node end |
#text ⇒ Object (readonly)
- String
-
the actual output that should be printed
1965 1966 1967 |
# File 'lib/syntax_tree/node.rb', line 1965 def text @text end |
Instance Method Details
#comments ⇒ Object
1975 1976 1977 |
# File 'lib/syntax_tree/node.rb', line 1975 def comments node.comments end |
#format(q) ⇒ Object
1979 1980 1981 |
# File 'lib/syntax_tree/node.rb', line 1979 def format(q) q.text(text) end |