Class: YARP::ConstantOperatorOrWriteNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::ConstantOperatorOrWriteNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents the use of the ‘||=` operator for assignment to a constant.
Target ||= value
^^^^^^^^^^^^^^^^
Instance Attribute Summary collapse
-
#name_loc ⇒ Object
readonly
attr_reader name_loc: Location.
-
#operator_loc ⇒ Object
readonly
attr_reader operator_loc: Location.
-
#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(name_loc, operator_loc, value, location) ⇒ ConstantOperatorOrWriteNode
constructor
def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void.
-
#name ⇒ Object
def name: () -> String.
-
#operator ⇒ Object
def operator: () -> String.
Constructor Details
#initialize(name_loc, operator_loc, value, location) ⇒ ConstantOperatorOrWriteNode
def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
1472 1473 1474 1475 1476 1477 |
# File 'lib/yarp/node.rb', line 1472 def initialize(name_loc, operator_loc, value, location) @name_loc = name_loc @operator_loc = operator_loc @value = value @location = location end |
Instance Attribute Details
#name_loc ⇒ Object (readonly)
attr_reader name_loc: Location
1463 1464 1465 |
# File 'lib/yarp/node.rb', line 1463 def name_loc @name_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
1466 1467 1468 |
# File 'lib/yarp/node.rb', line 1466 def operator_loc @operator_loc end |
#value ⇒ Object (readonly)
attr_reader value: Node
1469 1470 1471 |
# File 'lib/yarp/node.rb', line 1469 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
1480 1481 1482 |
# File 'lib/yarp/node.rb', line 1480 def accept(visitor) visitor.visit_constant_operator_or_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
1485 1486 1487 |
# File 'lib/yarp/node.rb', line 1485 def child_nodes [value] end |
#deconstruct_keys(keys) ⇒ Object
1493 1494 1495 |
# File 'lib/yarp/node.rb', line 1493 def deconstruct_keys(keys) { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location } end |
#name ⇒ Object
def name: () -> String
1498 1499 1500 |
# File 'lib/yarp/node.rb', line 1498 def name name_loc.slice end |
#operator ⇒ Object
def operator: () -> String
1503 1504 1505 |
# File 'lib/yarp/node.rb', line 1503 def operator operator_loc.slice end |