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.



2350
2351
2352
2353
# File 'lib/syntax_tree/node.rb', line 2350

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

Instance Attribute Details

#nodeObject (readonly)

LBrace | Keyword

the node that is being represented



2348
2349
2350
# File 'lib/syntax_tree/node.rb', line 2348

def node
  @node
end

#textObject (readonly)

String

the actual output that should be printed



2345
2346
2347
# File 'lib/syntax_tree/node.rb', line 2345

def text
  @text
end

Instance Method Details

#commentsObject



2355
2356
2357
# File 'lib/syntax_tree/node.rb', line 2355

def comments
  node.comments
end

#format(q) ⇒ Object



2359
2360
2361
# File 'lib/syntax_tree/node.rb', line 2359

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