Class: SyntaxTree::BlockFormatter::BlockOpenFormatter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, node) ⇒ BlockOpenFormatter

Returns a new instance of BlockOpenFormatter.



1878
1879
1880
1881
# File 'lib/syntax_tree/node.rb', line 1878

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

Instance Attribute Details

#nodeObject (readonly)

LBrace | Keyword

the node that is being represented



1876
1877
1878
# File 'lib/syntax_tree/node.rb', line 1876

def node
  @node
end

#textObject (readonly)

String

the actual output that should be printed



1873
1874
1875
# File 'lib/syntax_tree/node.rb', line 1873

def text
  @text
end

Instance Method Details

#commentsObject



1883
1884
1885
# File 'lib/syntax_tree/node.rb', line 1883

def comments
  node.comments
end

#format(q) ⇒ Object



1887
1888
1889
# File 'lib/syntax_tree/node.rb', line 1887

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