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.



2919
2920
2921
2922
# File 'lib/syntax_tree.rb', line 2919

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

Instance Attribute Details

#nodeObject (readonly)

LBrace | Keyword

the node that is being represented



2917
2918
2919
# File 'lib/syntax_tree.rb', line 2917

def node
  @node
end

#textObject (readonly)

String

the actual output that should be printed



2914
2915
2916
# File 'lib/syntax_tree.rb', line 2914

def text
  @text
end

Instance Method Details

#commentsObject



2924
2925
2926
# File 'lib/syntax_tree.rb', line 2924

def comments
  node.comments
end

#format(q) ⇒ Object



2928
2929
2930
# File 'lib/syntax_tree.rb', line 2928

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