るりまサーチ (Ruby 3.4)

最速Rubyリファレンスマニュアル検索!
1件ヒット [1-1件を表示] (0.064秒)

別のキーワード

  1. _builtin compact
  2. _builtin compact!
  3. pretty compact
  4. array compact
  5. array compact!

ライブラリ

検索結果

Enumerable#compact -> Array (54346.0)

self から nil を取り除いた配列を生成して返します。

self から nil を取り除いた配列を生成して返します。

//emlist[][ruby]{
def with_nils
yield 1
yield 2
yield nil
yield 3
end

to_enum(:with_nils).compact # => [1, 2, 3]
//}

@see Array#compact