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].
-
#copy(**params) ⇒ Object
def copy: (**params) -> ConstantPathNode.
- #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
1987 1988 1989 1990 1991 1992 |
# File 'lib/yarp/node.rb', line 1987 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
1981 1982 1983 |
# File 'lib/yarp/node.rb', line 1981 def child @child end |
#delimiter_loc ⇒ Object (readonly)
attr_reader delimiter_loc: Location
1984 1985 1986 |
# File 'lib/yarp/node.rb', line 1984 def delimiter_loc @delimiter_loc end |
#parent ⇒ Object (readonly)
attr_reader parent: Node?
1978 1979 1980 |
# File 'lib/yarp/node.rb', line 1978 def parent @parent end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
1995 1996 1997 |
# File 'lib/yarp/node.rb', line 1995 def accept(visitor) visitor.visit_constant_path_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
2000 2001 2002 |
# File 'lib/yarp/node.rb', line 2000 def child_nodes [parent, child] end |
#copy(**params) ⇒ Object
def copy: (**params) -> ConstantPathNode
2005 2006 2007 2008 2009 2010 2011 2012 |
# File 'lib/yarp/node.rb', line 2005 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) ⇒ Object
2018 2019 2020 |
# File 'lib/yarp/node.rb', line 2018 def deconstruct_keys(keys) { parent: parent, child: child, delimiter_loc: delimiter_loc, location: location } end |
#delimiter ⇒ Object
def delimiter: () -> String
2023 2024 2025 |
# File 'lib/yarp/node.rb', line 2023 def delimiter delimiter_loc.slice end |