るりまサーチ

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

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. rsa p
  5. dsa p=

ライブラリ

クラス

検索結果

Array#compact! -> self | nil (21254.0)

compact は自身から nil を取り除いた配列を生成して返します。 compact! は自身から破壊的に nil を取り除き、変更が 行われた場合は self を、そうでなければ nil を返します。

...compact は自身から nil を取り除いた配列を生成して返します。
compact!
は自身から破壊的に nil を取り除き、変更が
行われた場合は self を、そうでなければ nil を返します。

//emlist[例][ruby]{
ary = [1, nil, 2, nil, 3, nil]
p
ary.compact...
...#=> [1, 2, 3]
p
ary #=> [1, nil, 2, nil, 3, nil]
ary.compact!
p
ary #=> [1, 2, 3]
p
ary.compact! #=> nil
//}...

Hash#compact! -> self | nil (21248.0)

compact は自身から value が nil のもの取り除いた Hash を生成して返します。 compact! は自身から破壊的に value が nil のものを取り除き、変更が行われた場合は self を、そうでなければ nil を返します。

...compact は自身から value が nil のもの取り除いた Hash を生成して返します。 compact! は自身から破壊的に value が nil のものを取り除き、変更が行われた場合は self を、そうでなければ nil を返します。


//emlist[例][ruby]{
hash = {a: 1...
..., b: nil, c: 3}
p
hash.compact #=> {:a=>1, :c=>3}
p
hash #=> {:a=>1, :b=>nil, :c=>3}
hash.compact!
hash #=> {:a=>1, :c=>3}
p
hash.compact! #=> nil
//}

@see Array#compact...

Array#compact -> Array (6154.0)

compact は自身から nil を取り除いた配列を生成して返します。 compact! は自身から破壊的に nil を取り除き、変更が 行われた場合は self を、そうでなければ nil を返します。

...compact は自身から nil を取り除いた配列を生成して返します。
compact!
は自身から破壊的に nil を取り除き、変更が
行われた場合は self を、そうでなければ nil を返します。

//emlist[例][ruby]{
ary = [1, nil, 2, nil, 3, nil]
p
ary.compact...
...#=> [1, 2, 3]
p
ary #=> [1, nil, 2, nil, 3, nil]
ary.compact!
p
ary #=> [1, 2, 3]
p
ary.compact! #=> nil
//}...

Hash#compact -> Hash (6148.0)

compact は自身から value が nil のもの取り除いた Hash を生成して返します。 compact! は自身から破壊的に value が nil のものを取り除き、変更が行われた場合は self を、そうでなければ nil を返します。

...compact は自身から value が nil のもの取り除いた Hash を生成して返します。 compact! は自身から破壊的に value が nil のものを取り除き、変更が行われた場合は self を、そうでなければ nil を返します。


//emlist[例][ruby]{
hash = {a: 1...
..., b: nil, c: 3}
p
hash.compact #=> {:a=>1, :c=>3}
p
hash #=> {:a=>1, :b=>nil, :c=>3}
hash.compact!
hash #=> {:a=>1, :c=>3}
p
hash.compact! #=> nil
//}

@see Array#compact...