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.



12243
12244
12245
# File 'lib/syntax_tree.rb', line 12243

def initialize(node)
  @node = node
end

Instance Attribute Details

#nodeObject (readonly)

DynaSymbol | SymbolLiteral

the symbol to undefine



12241
12242
12243
# File 'lib/syntax_tree.rb', line 12241

def node
  @node
end

Instance Method Details

#commentsObject



12247
12248
12249
12250
12251
12252
12253
# File 'lib/syntax_tree.rb', line 12247

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

#format(q) ⇒ Object



12255
12256
12257
# File 'lib/syntax_tree.rb', line 12255

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