class SyntaxTree::TopConstRef
TopConstRef
is very similar to TopConstField
except that it is not involved in an assignment.
::Constant
Attributes
Const
-
the constant being referenced
Public Class Methods
Source
# File lib/syntax_tree/node.rb, line 10898 def initialize(constant:, location:) @constant = constant @location = location @comments = [] end
Public Instance Methods
Source
# File lib/syntax_tree/node.rb, line 10934 def ===(other) other.is_a?(TopConstRef) && constant === other.constant end
Source
# File lib/syntax_tree/node.rb, line 10904 def accept(visitor) visitor.visit_top_const_ref(self) end
Source
# File lib/syntax_tree/node.rb, line 10908 def child_nodes [constant] end
Also aliased as: deconstruct
Source
# File lib/syntax_tree/node.rb, line 10912 def copy(constant: nil, location: nil) node = TopConstRef.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 10925 def deconstruct_keys(_keys) { constant: constant, location: location, comments: comments } end
Source
# File lib/syntax_tree/node.rb, line 10929 def format(q) q.text("::") q.format(constant) end