method

compact

v1_8_7_330 - Show latest stable - Class: Array
compact()
public

Returns a copy of self with all nil elements removed.

[ "a", nil, "b", nil, "c", nil ].compact
                  #=> [ "a", "b", "c" ]