Class: SyntaxTree::Undef::UndefArgumentFormatter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ UndefArgumentFormatter

Returns a new instance of UndefArgumentFormatter.



10509
10510
10511
# File 'lib/syntax_tree/node.rb', line 10509

def initialize(node)
  @node = node
end

Instance Attribute Details

#nodeObject (readonly)

DynaSymbol | SymbolLiteral

the symbol to undefine



10507
10508
10509
# File 'lib/syntax_tree/node.rb', line 10507

def node
  @node
end

Instance Method Details

#commentsObject



10513
10514
10515
10516
10517
10518
10519
# File 'lib/syntax_tree/node.rb', line 10513

def comments
  if node.is_a?(SymbolLiteral)
    node.comments + node.value.comments
  else
    node.comments
  end
end

#format(q) ⇒ Object



10521
10522
10523
# File 'lib/syntax_tree/node.rb', line 10521

def format(q)
  node.is_a?(SymbolLiteral) ? q.format(node.value) : q.format(node)
end