種類
- 特異メソッド (27)
- インスタンスメソッド (19)
クラス
-
Enumerator
:: Lazy (11) - Hash (16)
モジュール
- Enumerable (3)
- GC (16)
キーワード
-
auto
_ compact (3) -
auto
_ compact= (3) - compact! (8)
- new (11)
-
verify
_ compaction _ references (5)
検索結果
先頭5件
-
Hash
# compact -> Hash (18166.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... -
Enumerable
# compact -> Array (18121.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 (18109.0) -
ヒープをコンパクションします。
...ヒープをコンパクションします。
詳細は15626を参照してください。
@see GC.verify_compaction_references... -
Hash
# compact! -> self | nil (6166.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... -
GC
. auto _ compact=(bool) (6143.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 (6138.0) -
コンパクションの参照の一貫性を検証します。
...ークスタックにプッシュされて、
SEGV が起きるでしょう。
@param toward nil か :empty を指定します。
@param double_heap ヒープサイズを2倍にするかどうかを真偽値で指定します。
@return GC.compact の返り値と同じです。
@see GC.compact... -
GC
. auto _ compact -> bool (6121.0) -
auto compaction が有効化どうかを返します。
...auto compaction が有効化どうかを返します。
@return auto compaction が有効な場合 true を返します。
そうでなければ false を返します。
@see GC.auto_compact=... -
Enumerator
:: Lazy . new(obj , size=nil) {|yielder , *values| . . . } -> Enumerator :: Lazy (20.0) -
Lazy Enumerator を作成します。Enumerator::Lazy#force メソッドなどに よって列挙が実行されたとき、objのeachメソッドが実行され、値が一つずつ ブロックに渡されます。ブロックは、yielder を使って最終的に yield される値を 指定できます。
...map(&block).compact
end
end
class Enumerator::Lazy
def filter_map
Lazy.new(self) do |yielder, *values|
result = yield *values
yielder << result if result
end
end
end
1.step.lazy.filter_map{|i| i*i if i.even?}.first(5)
# => [4, 16, 36, 64, 100]
//}
@raise ArgumentE......rror 引数を指定しなかった場合、ブロックを指定しなかった場合に発生します。
@see Enumerator.new...