method
compact_blank!
v6.1.3.1 -
Show latest stable
- 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]