Class: YARP::ConstantPathOperatorOrWriteNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::ConstantPathOperatorOrWriteNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents the use of the ‘||=` operator for assignment to a constant path.
Parent::Child ||= value
^^^^^^^^^^^^^^^^^^^^^^^
Instance Attribute Summary collapse
-
#operator_loc ⇒ Object
readonly
attr_reader operator_loc: Location.
-
#target ⇒ Object
readonly
attr_reader target: Node.
-
#value ⇒ Object
readonly
attr_reader value: 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
-
#initialize(target, operator_loc, value, location) ⇒ ConstantPathOperatorOrWriteNode
constructor
def initialize: (target: Node, operator_loc: Location, value: Node, location: Location) -> void.
-
#operator ⇒ Object
def operator: () -> String.
Constructor Details
#initialize(target, operator_loc, value, location) ⇒ ConstantPathOperatorOrWriteNode
def initialize: (target: Node, operator_loc: Location, value: Node, location: Location) -> void
1665 1666 1667 1668 1669 1670 |
# File 'lib/yarp/node.rb', line 1665 def initialize(target, operator_loc, value, location) @target = target @operator_loc = operator_loc @value = value @location = location end |
Instance Attribute Details
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
1659 1660 1661 |
# File 'lib/yarp/node.rb', line 1659 def operator_loc @operator_loc end |
#target ⇒ Object (readonly)
attr_reader target: Node
1656 1657 1658 |
# File 'lib/yarp/node.rb', line 1656 def target @target end |
#value ⇒ Object (readonly)
attr_reader value: Node
1662 1663 1664 |
# File 'lib/yarp/node.rb', line 1662 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
1673 1674 1675 |
# File 'lib/yarp/node.rb', line 1673 def accept(visitor) visitor.visit_constant_path_operator_or_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
1678 1679 1680 |
# File 'lib/yarp/node.rb', line 1678 def child_nodes [target, value] end |
#deconstruct_keys(keys) ⇒ Object
1686 1687 1688 |
# File 'lib/yarp/node.rb', line 1686 def deconstruct_keys(keys) { target: target, operator_loc: operator_loc, value: value, location: location } end |
#operator ⇒ Object
def operator: () -> String
1691 1692 1693 |
# File 'lib/yarp/node.rb', line 1691 def operator operator_loc.slice end |