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
Const
-
the constant being assigned
Public Class Methods
Source
# File lib/syntax_tree/node.rb, line 10845 def initialize(constant:, location:) @constant = constant @location = location @comments = [] end
Public Instance Methods
Source
# File lib/syntax_tree/node.rb, line 10881 def ===(other) other.is_a?(TopConstField) && constant === other.constant end
Source
# File lib/syntax_tree/node.rb, line 10851 def accept(visitor) visitor.visit_top_const_field(self) end
Source
# File lib/syntax_tree/node.rb, line 10855 def child_nodes [constant] end
Also aliased as: deconstruct
Source
# File lib/syntax_tree/node.rb, line 10859 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
Source
# File lib/syntax_tree/node.rb, line 10872 def deconstruct_keys(_keys) { constant: constant, location: location, comments: comments } end
Source
# File lib/syntax_tree/node.rb, line 10876 def format(q) q.text("::") q.format(constant) end