| Class | Node::OP_ASGN1 |
| In: |
ext/nodeinfo.c
|
| Parent: | Node |
Represents bracket assignment of the form:
recv[index] += value or recv[index] ||= value or recv[index] &&= value.
The index is obtained from args.body.
The value is obtained from args.head.
In the case of ||=, mid will be 0. The rhs will be equal to the result of evaluating args.head if the lhs is false, otherwise the rhs will be equal to lhs.
In the case of &&=, mid will be 1. The rhs will be equal to the lhs if lhs is false, otherwise the rhs will be equal to the result of evaluating args.head. In all other cases, mid will be the name of the method to call to calculate value, such that the expression is equivalent to:
recv[args.body] = recv[args.body].mid(args.head)
In no case does ruby short-circuit the assignment.