別のキーワード
種類
- インスタンスメソッド (48)
- 特異メソッド (30)
クラス
- Enumerator (6)
- PP (24)
モジュール
- Enumerable (48)
キーワード
- find (24)
- produce (6)
-
sharing
_ detection (12) -
sharing
_ detection= (12)
検索結果
先頭5件
-
Enumerable
# detect(ifnone = nil) -> Enumerator (18108.0) -
要素に対してブロックを評価した値が真になった最初の要素を返します。
...指定されているときは ifnone を call した結果を返します。
ブロックを省略した場合は Enumerator を返します。
@param ifnone call メソッドを持つオブジェクト (例えば Proc) を指定します。
//emlist[例][ruby]{
# 最初の 3 の倍数を探す... -
Enumerable
# detect(ifnone = nil) {|item| . . . } -> object (18108.0) -
要素に対してブロックを評価した値が真になった最初の要素を返します。
...指定されているときは ifnone を call した結果を返します。
ブロックを省略した場合は Enumerator を返します。
@param ifnone call メソッドを持つオブジェクト (例えば Proc) を指定します。
//emlist[例][ruby]{
# 最初の 3 の倍数を探す... -
PP
. sharing _ detection -> bool (6106.0) -
共有検出フラグを表すアクセサです。 デフォルトは false です。true である場合、 PP.pp は一度出力したオブジェクトを再び出力する時 Object#pretty_print_cycle を使います。
...bject#pretty_print_cycle を使います。
@param boolean 共有検出フラグを true か false で指定します。
//emlist[][ruby]{
require 'pp'
b = [1, 2, 3]
a = [b, b]
pp a #=> [[1, 2, 3], [1, 2, 3]]
PP.sharing_detection = true
pp a #=> [[1......時
Object#pretty_print_cycle を使います。
@param boolean 共有検出フラグを true か false で指定します。
//emlist[][ruby]{
b = [1, 2, 3]
a = [b, b]
pp a #=> [[1, 2, 3], [1, 2, 3]]
PP.sharing_detection = true
pp a #=> [[1, 2, 3],... -
PP
. sharing _ detection=(boolean) (6106.0) -
共有検出フラグを表すアクセサです。 デフォルトは false です。true である場合、 PP.pp は一度出力したオブジェクトを再び出力する時 Object#pretty_print_cycle を使います。
...bject#pretty_print_cycle を使います。
@param boolean 共有検出フラグを true か false で指定します。
//emlist[][ruby]{
require 'pp'
b = [1, 2, 3]
a = [b, b]
pp a #=> [[1, 2, 3], [1, 2, 3]]
PP.sharing_detection = true
pp a #=> [[1......時
Object#pretty_print_cycle を使います。
@param boolean 共有検出フラグを true か false で指定します。
//emlist[][ruby]{
b = [1, 2, 3]
a = [b, b]
pp a #=> [[1, 2, 3], [1, 2, 3]]
PP.sharing_detection = true
pp a #=> [[1, 2, 3],... -
Enumerable
# find(ifnone = nil) -> Enumerator (3008.0) -
要素に対してブロックを評価した値が真になった最初の要素を返します。
...指定されているときは ifnone を call した結果を返します。
ブロックを省略した場合は Enumerator を返します。
@param ifnone call メソッドを持つオブジェクト (例えば Proc) を指定します。
//emlist[例][ruby]{
# 最初の 3 の倍数を探す... -
Enumerable
# find(ifnone = nil) {|item| . . . } -> object (3008.0) -
要素に対してブロックを評価した値が真になった最初の要素を返します。
...指定されているときは ifnone を call した結果を返します。
ブロックを省略した場合は Enumerator を返します。
@param ifnone call メソッドを持つオブジェクト (例えば Proc) を指定します。
//emlist[例][ruby]{
# 最初の 3 の倍数を探す... -
Enumerator
. produce(initial = nil) { |prev| . . . } -> Enumerator (18.0) -
与えられたブロックを呼び出し続ける、停止しない Enumerator を返します。 ブロックの戻り値が、次にブロックを呼び出す時に引数として渡されます。 initial 引数が渡された場合、最初にブロックを呼び出す時にそれがブロック 呼び出しの引数として渡されます。initial が渡されなかった場合は nil が 渡されます。
...されなかった場合は nil が
渡されます。
ブロックが例外 StopIterationを投げた場合、繰り返しが終了します。
@param initial ブロックに最初に渡される値です。任意のオブジェクトを渡せます。
//emlist[例][ruby]{
# 1, 2, 3, 4, ... と......例えば Enumerable#detect, Enumerable#slice_after, Enumerable#take_while
などと合わせて使えるでしょう。
//emlist[Enumerable のメソッドと組み合わせる例][ruby]{
# 次の火曜日を返す例
require "date"
Enumerator.produce(Date.today, &:succ).detect(&:tuesday?)
# シ...