るりまサーチ

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

別のキーワード

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

ライブラリ

モジュール

キーワード

検索結果

Hash#compact -> Hash (18159.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 (18153.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
//}...

Enumerator::Lazy#compact -> Enumerator::Lazy (18118.0)

Enumerable#compact と同じですが、配列ではなく Enumerator::Lazy を返します。

...Enumerable#compact と同じですが、配列ではなく Enumerator::Lazy を返します。...

Enumerable#compact -> Array (18114.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...

REXML::Formatters::Pretty#compact -> bool (18108.0)

出力をコンパクトにするかどうかを返します。

...出力をコンパクトにするかどうかを返します。

これが真の場合、出力の空白をできる限り削除しようとします。

デフォルト値は false です。

@see REXML::Formatters::Pretty#compact=...

絞り込み条件を変える

Hash#compact! -> self | nil (6159.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! -> self | nil (6153.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
//}...

REXML::Formatters::Pretty#compact=(c) (6108.0)

出力をコンパクトにするかどうかを設定します。

...出力をコンパクトにするかどうかを設定します。

@param c コンパクトな出力をするかどうかを指定します。
@see REXML::Formatters::Pretty#compact...

Gem::Indexer#compact_specs(specs) -> Array (6102.0)

与えられたスペックを元にスペックを一意に特定できるだけの情報を持った配列を作成して 返します。

与えられたスペックを元にスペックを一意に特定できるだけの情報を持った配列を作成して
返します。

@param specs Gem::Specification の配列を指定します。