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
Returns a new instance of BlockOpenFormatter.
1908 1909 1910 1911 |
# File 'lib/syntax_tree/node.rb', line 1908 def initialize(text, node) @text = text @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
- LBrace | Keyword
-
the node that is being represented
1906 1907 1908 |
# File 'lib/syntax_tree/node.rb', line 1906 def node @node end |
#text ⇒ Object (readonly)
- String
-
the actual output that should be printed
1903 1904 1905 |
# File 'lib/syntax_tree/node.rb', line 1903 def text @text end |
Instance Method Details
#comments ⇒ Object
1913 1914 1915 |
# File 'lib/syntax_tree/node.rb', line 1913 def comments node.comments end |
#format(q) ⇒ Object
1917 1918 1919 |
# File 'lib/syntax_tree/node.rb', line 1917 def format(q) q.text(text) end |