class RuboCop::AST::MasgnNode
the AST, making its methods available to all assignment nodes within RuboCop.
This will be used in place of a plain node when the builder constructs
A node extension for ‘masgn` nodes.
def assignments
-
(Array
- the assignment nodes of the multiple assignment)
def assignments lhs.assignments end
def expression
-
(Node)
- the right hand side of a multiple assignment.
def expression node_parts[1] end
def lhs
-
(MlhsNode)
- the `mlhs` node
def lhs # The first child is a `mlhs` node node_parts[0] end
def multiple_rhs?
def multiple_rhs? expression.array_type? && !expression.bracketed? end
def names
-
(Array
- names of all the variables being assigned)
def names assignments.map do |assignment| if assignment.send_type? || assignment.indexasgn_type? assignment.method_name else assignment.name end end end
def values
-
(Array
- individual values being assigned on the RHS of the multiple assignment)
def values multiple_rhs? ? expression.children : [expression] end