class YARP::ConstantPathNode
Represents accessing a constant through a path of ‘::` operators.
Foo::Bar ^^^^^^^^
Attributes
child[R]
attr_reader child: Node
delimiter_loc[R]
attr_reader delimiter_loc
: Location
parent[R]
attr_reader parent: Node
?
Public Class Methods
new(parent, child, delimiter_loc, location)
click to toggle source
def initialize: (parent: Node
?, child: Node
, delimiter_loc
: Location
, location: Location
) -> void
# File yarp/node.rb, line 2936 def initialize(parent, child, delimiter_loc, location) @parent = parent @child = child @delimiter_loc = delimiter_loc @location = location end
Public Instance Methods
accept(visitor)
click to toggle source
def accept: (visitor: Visitor
) -> void
# File yarp/node.rb, line 2944 def accept(visitor) visitor.visit_constant_path_node(self) end
child_nodes()
click to toggle source
def child_nodes
: () -> Array[nil | Node]
# File yarp/node.rb, line 2949 def child_nodes [parent, child] end
Also aliased as: deconstruct
comment_targets()
click to toggle source
def comment_targets
: () -> Array[Node | Location]
# File yarp/node.rb, line 2954 def comment_targets [*parent, child, delimiter_loc] end
copy(**params)
click to toggle source
def copy: (**params) -> ConstantPathNode
# File yarp/node.rb, line 2959 def copy(**params) ConstantPathNode.new( params.fetch(:parent) { parent }, params.fetch(:child) { child }, params.fetch(:delimiter_loc) { delimiter_loc }, params.fetch(:location) { location }, ) end
deconstruct_keys(keys)
click to toggle source
delimiter()
click to toggle source
def delimiter: () -> String
# File yarp/node.rb, line 2977 def delimiter delimiter_loc.slice end
inspect(inspector = NodeInspector.new)
click to toggle source
# File yarp/node.rb, line 2981 def inspect(inspector = NodeInspector.new) inspector << inspector.header(self) if (parent = self.parent).nil? inspector << "├── parent: ∅\n" else inspector << "├── parent:\n" inspector << parent.inspect(inspector.child_inspector("│ ")).delete_prefix(inspector.prefix) end inspector << "├── child:\n" inspector << inspector.child_node(child, "│ ") inspector << "└── delimiter_loc: #{inspector.location(delimiter_loc)}\n" inspector.to_str end