Actions
Misc #11520
closedInconsistent behavior in Array#compact!
Misc #11520:
Inconsistent behavior in Array#compact!
Status:
Rejected
Assignee:
-
Description
I noticed that Array#compact! sometimes returns self and other times nil. This behavior was a bit confusing.
[].compact!
# => nil
[1].compact!
# => nil
[nil].compact!
# => []
[1, nil].compact!
# => [1]
I would prefer that Array#compact! either always returns nil, or always returns self.
Actions