Class: YARP::ConstantPathNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::ConstantPathNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents accessing a constant through a path of ‘::` operators.
Foo::Bar
^^^^^^^^
Instance Attribute Summary collapse
-
#child ⇒ Object
readonly
attr_reader child: Node.
-
#delimiter_loc ⇒ Object
readonly
attr_reader delimiter_loc: Location.
-
#parent ⇒ Object
readonly
attr_reader parent: Node?.
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
- #deconstruct_keys(keys) ⇒ Object
-
#delimiter ⇒ Object
def delimiter: () -> String.
-
#initialize(parent, child, delimiter_loc, location) ⇒ ConstantPathNode
constructor
def initialize: (parent: Node?, child: Node, delimiter_loc: Location, location: Location) -> void.
Constructor Details
#initialize(parent, child, delimiter_loc, location) ⇒ ConstantPathNode
def initialize: (parent: Node?, child: Node, delimiter_loc: Location, location: Location) -> void
1592 1593 1594 1595 1596 1597 |
# File 'lib/yarp/node.rb', line 1592 def initialize(parent, child, delimiter_loc, location) @parent = parent @child = child @delimiter_loc = delimiter_loc @location = location end |
Instance Attribute Details
#child ⇒ Object (readonly)
attr_reader child: Node
1586 1587 1588 |
# File 'lib/yarp/node.rb', line 1586 def child @child end |
#delimiter_loc ⇒ Object (readonly)
attr_reader delimiter_loc: Location
1589 1590 1591 |
# File 'lib/yarp/node.rb', line 1589 def delimiter_loc @delimiter_loc end |
#parent ⇒ Object (readonly)
attr_reader parent: Node?
1583 1584 1585 |
# File 'lib/yarp/node.rb', line 1583 def parent @parent end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
1600 1601 1602 |
# File 'lib/yarp/node.rb', line 1600 def accept(visitor) visitor.visit_constant_path_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
1606 1607 1608 |
# File 'lib/yarp/node.rb', line 1606 def child_nodes [parent, child] end |
#deconstruct_keys(keys) ⇒ Object
1614 1615 1616 |
# File 'lib/yarp/node.rb', line 1614 def deconstruct_keys(keys) { parent: parent, child: child, delimiter_loc: delimiter_loc, location: location } end |
#delimiter ⇒ Object
def delimiter: () -> String
1619 1620 1621 |
# File 'lib/yarp/node.rb', line 1619 def delimiter delimiter_loc.slice end |