class SyntaxTree::Undef
Undef
represents the use of the undef
keyword.
undef method
Attributes
symbols[R]
- Array[
DynaSymbol
|SymbolLiteral
] -
the symbols to undefine
Public Class Methods
new(symbols:, location:)
click to toggle source
# File lib/syntax_tree/node.rb, line 11255 def initialize(symbols:, location:) @symbols = symbols @location = location @comments = [] end
Public Instance Methods
===(other)
click to toggle source
# File lib/syntax_tree/node.rb, line 11298 def ===(other) other.is_a?(Undef) && ArrayMatch.call(symbols, other.symbols) end
accept(visitor)
click to toggle source
# File lib/syntax_tree/node.rb, line 11261 def accept(visitor) visitor.visit_undef(self) end
child_nodes()
click to toggle source
# File lib/syntax_tree/node.rb, line 11265 def child_nodes symbols end
Also aliased as: deconstruct
copy(symbols: nil, location: nil)
click to toggle source
# File lib/syntax_tree/node.rb, line 11269 def copy(symbols: nil, location: nil) node = Undef.new( symbols: symbols || self.symbols, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node end
deconstruct_keys(_keys)
click to toggle source
# File lib/syntax_tree/node.rb, line 11282 def deconstruct_keys(_keys) { symbols: symbols, location: location, comments: comments } end
format(q)
click to toggle source
# File lib/syntax_tree/node.rb, line 11286 def format(q) keyword = "undef " formatters = symbols.map { |symbol| UndefArgumentFormatter.new(symbol) } q.group do q.text(keyword) q.nest(keyword.length) do q.seplist(formatters) { |formatter| q.format(formatter) } end end end