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.



8269
8270
8271
# File 'lib/syntax_tree/node.rb', line 8269

def initialize(node)
  @node = node
end

Instance Attribute Details

#nodeObject (readonly)

DynaSymbol | SymbolLiteral

the symbol to undefine



8267
8268
8269
# File 'lib/syntax_tree/node.rb', line 8267

def node
  @node
end

Instance Method Details

#commentsObject



8273
8274
8275
8276
8277
8278
8279
# File 'lib/syntax_tree/node.rb', line 8273

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

#format(q) ⇒ Object



8281
8282
8283
# File 'lib/syntax_tree/node.rb', line 8281

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