Class: SyntaxTree::BlockFormatter::BlockOpenFormatter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, node) ⇒ BlockOpenFormatter

Returns a new instance of BlockOpenFormatter.



2668
2669
2670
2671
# File 'lib/syntax_tree.rb', line 2668

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

Instance Attribute Details

#nodeObject (readonly)

LBrace | Keyword

the node that is being represented



2666
2667
2668
# File 'lib/syntax_tree.rb', line 2666

def node
  @node
end

#textObject (readonly)

String

the actual output that should be printed



2663
2664
2665
# File 'lib/syntax_tree.rb', line 2663

def text
  @text
end

Instance Method Details

#commentsObject



2673
2674
2675
# File 'lib/syntax_tree.rb', line 2673

def comments
  node.comments
end

#format(q) ⇒ Object



2677
2678
2679
# File 'lib/syntax_tree.rb', line 2677

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