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.



1830
1831
1832
1833
# File 'lib/syntax_tree/node.rb', line 1830

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

Instance Attribute Details

#nodeObject (readonly)

LBrace | Keyword

the node that is being represented



1828
1829
1830
# File 'lib/syntax_tree/node.rb', line 1828

def node
  @node
end

#textObject (readonly)

String

the actual output that should be printed



1825
1826
1827
# File 'lib/syntax_tree/node.rb', line 1825

def text
  @text
end

Instance Method Details

#commentsObject



1835
1836
1837
# File 'lib/syntax_tree/node.rb', line 1835

def comments
  node.comments
end

#format(q) ⇒ Object



1839
1840
1841
# File 'lib/syntax_tree/node.rb', line 1839

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