Class: SyntaxTree::Undef::UndefArgumentFormatter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ UndefArgumentFormatter

Returns a new instance of UndefArgumentFormatter.



12375
12376
12377
# File 'lib/syntax_tree.rb', line 12375

def initialize(node)
  @node = node
end

Instance Attribute Details

#nodeObject (readonly)

DynaSymbol | SymbolLiteral

the symbol to undefine



12373
12374
12375
# File 'lib/syntax_tree.rb', line 12373

def node
  @node
end

Instance Method Details

#commentsObject



12379
12380
12381
12382
12383
12384
12385
# File 'lib/syntax_tree.rb', line 12379

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

#format(q) ⇒ Object



12387
12388
12389
# File 'lib/syntax_tree.rb', line 12387

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