Class: SyntaxTree::BlockNode::BlockOpenFormatter

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

Overview

Formats the opening brace or keyword of a block.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, node) ⇒ BlockOpenFormatter

Returns a new instance of BlockOpenFormatter.



4300
4301
4302
4303
# File 'lib/syntax_tree/node.rb', line 4300

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

Instance Attribute Details

#nodeObject (readonly)

LBrace | Keyword

the node that is being represented



4298
4299
4300
# File 'lib/syntax_tree/node.rb', line 4298

def node
  @node
end

#textObject (readonly)

String

the actual output that should be printed



4295
4296
4297
# File 'lib/syntax_tree/node.rb', line 4295

def text
  @text
end

Instance Method Details

#commentsObject



4305
4306
4307
# File 'lib/syntax_tree/node.rb', line 4305

def comments
  node.comments
end

#format(q) ⇒ Object



4309
4310
4311
# File 'lib/syntax_tree/node.rb', line 4309

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