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.



2798
2799
2800
2801
# File 'lib/syntax_tree.rb', line 2798

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

Instance Attribute Details

#nodeObject (readonly)

LBrace | Keyword

the node that is being represented



2796
2797
2798
# File 'lib/syntax_tree.rb', line 2796

def node
  @node
end

#textObject (readonly)

String

the actual output that should be printed



2793
2794
2795
# File 'lib/syntax_tree.rb', line 2793

def text
  @text
end

Instance Method Details

#commentsObject



2803
2804
2805
# File 'lib/syntax_tree.rb', line 2803

def comments
  node.comments
end

#format(q) ⇒ Object



2807
2808
2809
# File 'lib/syntax_tree.rb', line 2807

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