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.



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

def initialize(node)
  @node = node
end

Instance Attribute Details

#nodeObject (readonly)

DynaSymbol | SymbolLiteral

the symbol to undefine



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

def node
  @node
end

Instance Method Details

#commentsObject



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

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

#format(q) ⇒ Object



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

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