Class: SyntaxTree::BlockFormatter::BlockOpenFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/syntax_tree/node.rb

Overview

Formats the opening brace or keyword of a block.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, node) ⇒ BlockOpenFormatter

Returns a new instance of BlockOpenFormatter.



1918
1919
1920
1921
# File 'lib/syntax_tree/node.rb', line 1918

def initialize(text, node)
  @text = text
  @node = node
end

Instance Attribute Details

#node ⇒ Object (readonly)

[LBrace | Keyword] the node that is being represented



1916
1917
1918
# File 'lib/syntax_tree/node.rb', line 1916

def node
  @node
end

#text ⇒ Object (readonly)

[String] the actual output that should be printed



1913
1914
1915
# File 'lib/syntax_tree/node.rb', line 1913

def text
  @text
end

Instance Method Details

#comments ⇒ Object



1923
1924
1925
# File 'lib/syntax_tree/node.rb', line 1923

def comments
  node.comments
end

#format(q) ⇒ Object



1927
1928
1929
# File 'lib/syntax_tree/node.rb', line 1927

def format(q)
  q.text(text)
end