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.



8830
8831
8832
# File 'lib/syntax_tree/node.rb', line 8830

def initialize(node)
  @node = node
end

Instance Attribute Details

#nodeObject (readonly)

DynaSymbol | SymbolLiteral

the symbol to undefine



8828
8829
8830
# File 'lib/syntax_tree/node.rb', line 8828

def node
  @node
end

Instance Method Details

#commentsObject



8834
8835
8836
8837
8838
8839
8840
# File 'lib/syntax_tree/node.rb', line 8834

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

#format(q) ⇒ Object



8842
8843
8844
# File 'lib/syntax_tree/node.rb', line 8842

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