るりまサーチ

最速Rubyリファレンスマニュアル検索!
99件ヒット [1-99件を表示] (0.038秒)
トップページ > クエリ:@[x] > クエリ:compact[x]

別のキーワード

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

検索結果

Hash#compact -> Hash (18164.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 (18119.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 (18113.0)

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

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

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

デフォルト値は false です。

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

GC.compact -> Hash (18107.0)

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

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

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

@
see GC.verify_compaction_references...

Hash#compact! -> self | nil (6164.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) (6141.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 (6136.0)

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

...ークスタックにプッシュされて、
SEGV が起きるでしょう。

@
param toward nil か :empty を指定します。
@
param double_heap ヒープサイズを2倍にするかどうかを真偽値で指定します。

@
return GC.compact の返り値と同じです。

@
see GC.compact...

GC.auto_compact -> bool (6119.0)

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

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

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

@
see GC.auto_compact=...

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

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

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

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

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

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

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

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

絞り込み条件を変える

NEWS for Ruby 3.0.0 (30.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...rue` is used. 17104
* Magic comment `shareable_constant_value` added to freeze constants.
See {Magic Comments}[rdoc-ref:doc/syntax/comments.rdoc@Magic+Comments] for more details.
17273
* A {static analysis}[rdoc-label:label-Static+analysis] foundation is
introduced.
* {RBS}[rdo...
...Fiber#transfer is relaxed. 17221
* GC
* GC.auto_compact= and GC.auto_compact have been added to control when compaction runs. Setting `auto_compact=` to `true` will cause compaction to occur during major collections. At the moment, compaction adds significant overhead to major collections, s...
...on uses only methods ending with `!`.
* Ractor compatible.
* Improved support for YAML. 8382
* Use officially discouraged. Read OpenStruct@Caveats section.
* Pathname
* Ractor compatible.
* Psych
* Update to Psych 3.3.0
* This version is Ractor compatible.
* Reline...

NEWS for Ruby 3.1.0 (24.0)

NEWS for Ruby 3.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...演算子がインスタンス変数、クラス変数、グローバル変数をサポートしました。 17724

//emlist{
@
n = 5
Prime.each_cons(2).lazy.find{_1 in [n, ^@n]}
#=> [3, 5]
//}

* 1行パターンマッチが実験的な機能ではなくなりました。

* 1行パターンマ...
...< A; end
A.subclasses #=> [D, B]
B.subclasses #=> [C]
C.subclasses #=> []
//}

* Enumerable
* 新規メソッド
* Enumerable#compactが追加されました。 17312
* Enumerable#tallyがカウント集計用のハッシュオブジェクトを任意で渡せるように...
...> [1, 2, 3]

[1, 2, 3].each_slice(2){}
# 3.0 => nil
# 3.1 => [1, 2, 3]
//}

* Enumerator::Lazy
* 新規メソッド
* Enumerator::Lazy#compact が追加されました。 17312

* File
* 変更されたメソッド
* File.dirname がパスの階層を取り除く任意の引...

Enumerator::Lazy.new(obj, size=nil) {|yielder, *values| ... } -> Enumerator::Lazy (18.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...