Class: YARP::ClassVariableOperatorWriteNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::ClassVariableOperatorWriteNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents assigning to a class variable using an operator that isn’t ‘=`.
@@target += value
^^^^^^^^^^^^^^^^^
Instance Attribute Summary collapse
-
#name_loc ⇒ Object
readonly
attr_reader name_loc: Location.
-
#operator ⇒ Object
readonly
attr_reader operator: Symbol.
-
#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, operator, location) ⇒ ClassVariableOperatorWriteNode
constructor
def initialize: (name_loc: Location, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void.
-
#name ⇒ Object
def name: () -> String.
Constructor Details
#initialize(name_loc, operator_loc, value, operator, location) ⇒ ClassVariableOperatorWriteNode
def initialize: (name_loc: Location, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
1307 1308 1309 1310 1311 1312 1313 |
# File 'lib/yarp/node.rb', line 1307 def initialize(name_loc, operator_loc, value, operator, location) @name_loc = name_loc @operator_loc = operator_loc @value = value @operator = operator @location = location end |
Instance Attribute Details
#name_loc ⇒ Object (readonly)
attr_reader name_loc: Location
1295 1296 1297 |
# File 'lib/yarp/node.rb', line 1295 def name_loc @name_loc end |
#operator ⇒ Object (readonly)
attr_reader operator: Symbol
1304 1305 1306 |
# File 'lib/yarp/node.rb', line 1304 def operator @operator end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
1298 1299 1300 |
# File 'lib/yarp/node.rb', line 1298 def operator_loc @operator_loc end |
#value ⇒ Object (readonly)
attr_reader value: Node
1301 1302 1303 |
# File 'lib/yarp/node.rb', line 1301 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
1316 1317 1318 |
# File 'lib/yarp/node.rb', line 1316 def accept(visitor) visitor.visit_class_variable_operator_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
1322 1323 1324 |
# File 'lib/yarp/node.rb', line 1322 def child_nodes [value] end |
#deconstruct_keys(keys) ⇒ Object
1330 1331 1332 |
# File 'lib/yarp/node.rb', line 1330 def deconstruct_keys(keys) { name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location } end |
#name ⇒ Object
def name: () -> String
1335 1336 1337 |
# File 'lib/yarp/node.rb', line 1335 def name name_loc.slice end |