Class: YARP::ClassVariableOperatorAndWriteNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::ClassVariableOperatorAndWriteNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents the use of the ‘&&=` operator for assignment to a class variable.
@@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) ⇒ ClassVariableOperatorAndWriteNode
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) ⇒ ClassVariableOperatorAndWriteNode
def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
1200 1201 1202 1203 1204 1205 |
# File 'lib/yarp/node.rb', line 1200 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
1191 1192 1193 |
# File 'lib/yarp/node.rb', line 1191 def name_loc @name_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
1194 1195 1196 |
# File 'lib/yarp/node.rb', line 1194 def operator_loc @operator_loc end |
#value ⇒ Object (readonly)
attr_reader value: Node
1197 1198 1199 |
# File 'lib/yarp/node.rb', line 1197 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
1208 1209 1210 |
# File 'lib/yarp/node.rb', line 1208 def accept(visitor) visitor.visit_class_variable_operator_and_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
1214 1215 1216 |
# File 'lib/yarp/node.rb', line 1214 def child_nodes [value] end |
#deconstruct_keys(keys) ⇒ Object
1222 1223 1224 |
# File 'lib/yarp/node.rb', line 1222 def deconstruct_keys(keys) { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location } end |
#name ⇒ Object
def name: () -> String
1227 1228 1229 |
# File 'lib/yarp/node.rb', line 1227 def name name_loc.slice end |
#operator ⇒ Object
def operator: () -> String
1232 1233 1234 |
# File 'lib/yarp/node.rb', line 1232 def operator operator_loc.slice end |