compact! -> self | nil[permalink][rdoc][edit]() → self?-
自身から破壊的に nil を取り除き、変更が行われた場合は self を、そうでなければ nil を返します。
例ary = [1, nil, 2, nil, 3, nil] ary.compact! p ary # => [1, 2, 3] p ary.compact! # => nil[SEE_ALSO] Array#compact
compact! -> self | nil[permalink][rdoc][edit]() → self?自身から破壊的に nil を取り除き、変更が行われた場合は self を、そうでなければ nil を返します。
例ary = [1, nil, 2, nil, 3, nil]
ary.compact!
p ary # => [1, 2, 3]
p ary.compact! # => nil
[SEE_ALSO] Array#compact