Class: YARP::ClassVariableOperatorOrWriteNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::ClassVariableOperatorOrWriteNode
- 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) ⇒ ClassVariableOperatorOrWriteNode
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) ⇒ ClassVariableOperatorOrWriteNode
def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
1252 1253 1254 1255 1256 1257 |
# File 'lib/yarp/node.rb', line 1252 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
1243 1244 1245 |
# File 'lib/yarp/node.rb', line 1243 def name_loc @name_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
1246 1247 1248 |
# File 'lib/yarp/node.rb', line 1246 def operator_loc @operator_loc end |
#value ⇒ Object (readonly)
attr_reader value: Node
1249 1250 1251 |
# File 'lib/yarp/node.rb', line 1249 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
1260 1261 1262 |
# File 'lib/yarp/node.rb', line 1260 def accept(visitor) visitor.visit_class_variable_operator_or_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
1266 1267 1268 |
# File 'lib/yarp/node.rb', line 1266 def child_nodes [value] end |
#deconstruct_keys(keys) ⇒ Object
1274 1275 1276 |
# File 'lib/yarp/node.rb', line 1274 def deconstruct_keys(keys) { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location } end |
#name ⇒ Object
def name: () -> String
1279 1280 1281 |
# File 'lib/yarp/node.rb', line 1279 def name name_loc.slice end |
#operator ⇒ Object
def operator: () -> String
1284 1285 1286 |
# File 'lib/yarp/node.rb', line 1284 def operator operator_loc.slice end |