るりまサーチ (Ruby 3.2)

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

モジュール

検索結果

Array#compact -> Array (96829.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 (96829.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, :...

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

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

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

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

GC.compact -> Hash (96604.0)

ヒープをコンパクションします。

ヒープをコンパクションします。

詳細は15626を参照してください。

@see GC.verify_compaction_references

絞り込み条件を変える

Array#compact! -> self | nil (60829.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 (60829.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, :...

GC.auto_compact=(bool) (60688.0)

GC.compact をフルGCで行うかどうかを制御します。

GC.compact をフルGCで行うかどうかを制御します。

true を設定するとフルGCのタイミングででヒープをコンパクションします。

この機能を有効にするとフルGCのパフォーマンスが低下します。

デフォルトは false です。

詳細は17176を参照してください。

@param bool フルGCでコンパクションするかどうかを true か false で設定します。

@see GC.compact GC.auto_compact

GC.verify_compaction_references(toward: nil, double_heap: nil) -> Hash (60637.0)

コンパクションの参照の一貫性を検証します。

コンパクションの参照の一貫性を検証します。

このメソッドは処理系依存 (CRuby 特有) です。
コンパクション中に移動されたオブジェクトは T_MOVED オブジェクトに置き換えられます。
コンパクション後には T_MOVED を参照するオブジェクトは存在するべきではありません。

この関数は全てのオブジェクトが移動する余地を確保するためにヒープを2倍にして、
全ての移動を確実にするためにヒープをコンパクションして、全ての参照を更新して、
それからフルGCを実行します。
もし T_MOVED への参照をもつオブジェクトがあれば、マークスタックにプッシュされて、
SEGV が起きるでしょ...

GC.auto_compact -> bool (60622.0)

auto compaction が有効化どうかを返します。

auto compaction が有効化どうかを返します。

@return auto compaction が有効な場合 true を返します。
そうでなければ false を返します。

@see GC.auto_compact=

絞り込み条件を変える

Enumerator::Lazy (24055.0)

map や select などのメソッドの遅延評価版を提供するためのクラス。

map や select などのメソッドの遅延評価版を提供するためのクラス。

動作は通常の Enumerator と同じですが、以下のメソッドが遅延評価を行う
(つまり、配列ではなく Enumerator を返す) ように再定義されています。

* map/collect
* flat_map/collect_concat
* filter_map
* select/find_all
* reject
* grep, grep_v
* take, take_while
* drop, drop_while
* slice_before, slice_after, slice...