Class: YARP::MultiWriteNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::MultiWriteNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents a multi-target expression.
a, b, c = 1, 2, 3
^^^^^^^^^^^^^^^^^
Instance Attribute Summary collapse
-
#lparen_loc ⇒ Object
readonly
attr_reader lparen_loc: Location?.
-
#operator_loc ⇒ Object
readonly
attr_reader operator_loc: Location?.
-
#rparen_loc ⇒ Object
readonly
attr_reader rparen_loc: Location?.
-
#targets ⇒ Object
readonly
attr_reader targets: Array.
-
#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(targets, operator_loc, value, lparen_loc, rparen_loc, location) ⇒ MultiWriteNode
constructor
def initialize: (targets: Array, operator_loc: Location?, value: Node?, lparen_loc: Location?, rparen_loc: Location?, location: Location) -> void.
-
#lparen ⇒ Object
def lparen: () -> String?.
-
#operator ⇒ Object
def operator: () -> String?.
-
#rparen ⇒ Object
def rparen: () -> String?.
Constructor Details
#initialize(targets, operator_loc, value, lparen_loc, rparen_loc, location) ⇒ MultiWriteNode
def initialize: (targets: Array, operator_loc: Location?, value: Node?, lparen_loc: Location?, rparen_loc: Location?, location: Location) -> void
4266 4267 4268 4269 4270 4271 4272 4273 |
# File 'lib/yarp/node.rb', line 4266 def initialize(targets, operator_loc, value, lparen_loc, rparen_loc, location) @targets = targets @operator_loc = operator_loc @value = value @lparen_loc = lparen_loc @rparen_loc = rparen_loc @location = location end |
Instance Attribute Details
#lparen_loc ⇒ Object (readonly)
attr_reader lparen_loc: Location?
4260 4261 4262 |
# File 'lib/yarp/node.rb', line 4260 def lparen_loc @lparen_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location?
4254 4255 4256 |
# File 'lib/yarp/node.rb', line 4254 def operator_loc @operator_loc end |
#rparen_loc ⇒ Object (readonly)
attr_reader rparen_loc: Location?
4263 4264 4265 |
# File 'lib/yarp/node.rb', line 4263 def rparen_loc @rparen_loc end |
#targets ⇒ Object (readonly)
attr_reader targets: Array
4251 4252 4253 |
# File 'lib/yarp/node.rb', line 4251 def targets @targets end |
#value ⇒ Object (readonly)
attr_reader value: Node?
4257 4258 4259 |
# File 'lib/yarp/node.rb', line 4257 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
4276 4277 4278 |
# File 'lib/yarp/node.rb', line 4276 def accept(visitor) visitor.visit_multi_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
4281 4282 4283 |
# File 'lib/yarp/node.rb', line 4281 def child_nodes [*targets, value] end |
#deconstruct_keys(keys) ⇒ Object
4289 4290 4291 |
# File 'lib/yarp/node.rb', line 4289 def deconstruct_keys(keys) { targets: targets, operator_loc: operator_loc, value: value, lparen_loc: lparen_loc, rparen_loc: rparen_loc, location: location } end |
#lparen ⇒ Object
def lparen: () -> String?
4299 4300 4301 |
# File 'lib/yarp/node.rb', line 4299 def lparen lparen_loc&.slice end |
#operator ⇒ Object
def operator: () -> String?
4294 4295 4296 |
# File 'lib/yarp/node.rb', line 4294 def operator operator_loc&.slice end |
#rparen ⇒ Object
def rparen: () -> String?
4304 4305 4306 |
# File 'lib/yarp/node.rb', line 4304 def rparen rparen_loc&.slice end |