class SyntaxTree::ConstPathRef
ConstPathRef
represents referencing a constant by a path.
object::Const
Attributes
Const
-
the constant itself
Node
-
the source of the constant
Public Class Methods
Source
# File lib/syntax_tree/node.rb, line 3954 def initialize(parent:, constant:, location:) @parent = parent @constant = constant @location = location @comments = [] end
Public Instance Methods
Source
# File lib/syntax_tree/node.rb, line 3998 def ===(other) other.is_a?(ConstPathRef) && parent === other.parent && constant === other.constant end
Source
# File lib/syntax_tree/node.rb, line 3961 def accept(visitor) visitor.visit_const_path_ref(self) end
Source
# File lib/syntax_tree/node.rb, line 3965 def child_nodes [parent, constant] end
Also aliased as: deconstruct
Source
# File lib/syntax_tree/node.rb, line 3969 def copy(parent: nil, constant: nil, location: nil) node = ConstPathRef.new( parent: parent || self.parent, constant: constant || self.constant, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node end
Source
# File lib/syntax_tree/node.rb, line 3983 def deconstruct_keys(_keys) { parent: parent, constant: constant, location: location, comments: comments } end
Source
# File lib/syntax_tree/node.rb, line 3992 def format(q) q.format(parent) q.text("::") q.format(constant) end