method

compact_blank!

Importance_1
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: Array
compact_blank!() public

Removes all blank elements from the Array in place and returns self. Uses Object#blank? for determining if an item is blank.

a = [1, "", nil, 2, " ", [], {}, false, true]
a.compact_blank!
# =>  [1, 2, true]
Show source
Register or log in to add new notes.