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.



12163
12164
12165
# File 'lib/syntax_tree.rb', line 12163

def initialize(node)
  @node = node
end

Instance Attribute Details

#nodeObject (readonly)

DynaSymbol | SymbolLiteral

the symbol to undefine



12161
12162
12163
# File 'lib/syntax_tree.rb', line 12161

def node
  @node
end

Instance Method Details

#commentsObject



12167
12168
12169
12170
12171
12172
12173
# File 'lib/syntax_tree.rb', line 12167

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

#format(q) ⇒ Object



12175
12176
12177
# File 'lib/syntax_tree.rb', line 12175

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