class SyntaxTree::TopConstField
TopConstField
is always the child node of some kind of assignment. It represents when you’re assigning to a constant that is being referenced at the top level.
::Constant = value
Attributes
constant[R]
Const
-
the constant being assigned
Public Class Methods
new(constant:, location:)
click to toggle source
# File lib/syntax_tree/node.rb, line 10830 def initialize(constant:, location:) @constant = constant @location = location @comments = [] end
Public Instance Methods
===(other)
click to toggle source
# File lib/syntax_tree/node.rb, line 10866 def ===(other) other.is_a?(TopConstField) && constant === other.constant end
accept(visitor)
click to toggle source
# File lib/syntax_tree/node.rb, line 10836 def accept(visitor) visitor.visit_top_const_field(self) end
child_nodes()
click to toggle source
# File lib/syntax_tree/node.rb, line 10840 def child_nodes [constant] end
Also aliased as: deconstruct
copy(constant: nil, location: nil)
click to toggle source
# File lib/syntax_tree/node.rb, line 10844 def copy(constant: nil, location: nil) node = TopConstField.new( constant: constant || self.constant, 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 10857 def deconstruct_keys(_keys) { constant: constant, location: location, comments: comments } end
format(q)
click to toggle source
# File lib/syntax_tree/node.rb, line 10861 def format(q) q.text("::") q.format(constant) end