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
4238 4239 4240 4241 4242 4243 4244 4245 |
# File 'lib/yarp/node.rb', line 4238 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?
4232 4233 4234 |
# File 'lib/yarp/node.rb', line 4232 def lparen_loc @lparen_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location?
4226 4227 4228 |
# File 'lib/yarp/node.rb', line 4226 def operator_loc @operator_loc end |
#rparen_loc ⇒ Object (readonly)
attr_reader rparen_loc: Location?
4235 4236 4237 |
# File 'lib/yarp/node.rb', line 4235 def rparen_loc @rparen_loc end |
#targets ⇒ Object (readonly)
attr_reader targets: Array
4223 4224 4225 |
# File 'lib/yarp/node.rb', line 4223 def targets @targets end |
#value ⇒ Object (readonly)
attr_reader value: Node?
4229 4230 4231 |
# File 'lib/yarp/node.rb', line 4229 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
4248 4249 4250 |
# File 'lib/yarp/node.rb', line 4248 def accept(visitor) visitor.visit_multi_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
4254 4255 4256 |
# File 'lib/yarp/node.rb', line 4254 def child_nodes [*targets, value] end |
#deconstruct_keys(keys) ⇒ Object
4262 4263 4264 |
# File 'lib/yarp/node.rb', line 4262 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?
4272 4273 4274 |
# File 'lib/yarp/node.rb', line 4272 def lparen lparen_loc&.slice end |
#operator ⇒ Object
def operator: () -> String?
4267 4268 4269 |
# File 'lib/yarp/node.rb', line 4267 def operator operator_loc&.slice end |
#rparen ⇒ Object
def rparen: () -> String?
4277 4278 4279 |
# File 'lib/yarp/node.rb', line 4277 def rparen rparen_loc&.slice end |