るりまサーチ

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

別のキーワード

  1. erb u
  2. _builtin koi8_u
  3. util u
  4. lupdecomposition u
  5. matrix u

ライブラリ

クラス

モジュール

検索結果

Enumerator#with_object(obj) -> Enumerator (27320.0)

繰り返しの各要素に obj を添えてブロックを繰り返し、obj を返り値として返します。

...bj を返す Enumerator を返します。

//emlist[例][ruby]{
# 0,1,2 と呼びだす enumeratorを作る
to_three = Enumerator.new do |y|
3.times do |x|
y << x
end
end

to_three_with_string = to_three.with_object("foo")
to_three_with_string.each do |x,string|
puts "#{string}: #{x}"
end...
...# => foo:0
# => foo:1
# => foo:2
//}

@param obj 繰り返しの各要素に添えて渡されるオブジェクト
@see Enumerable#each_with_object...

Enumerator#with_object(obj) {|(*args), memo_obj| ... } -> object (27220.0)

繰り返しの各要素に obj を添えてブロックを繰り返し、obj を返り値として返します。

...bj を返す Enumerator を返します。

//emlist[例][ruby]{
# 0,1,2 と呼びだす enumeratorを作る
to_three = Enumerator.new do |y|
3.times do |x|
y << x
end
end

to_three_with_string = to_three.with_object("foo")
to_three_with_string.each do |x,string|
puts "#{string}: #{x}"
end...
...# => foo:0
# => foo:1
# => foo:2
//}

@param obj 繰り返しの各要素に添えて渡されるオブジェクト
@see Enumerable#each_with_object...

Enumerable#each_with_object(obj) -> Enumerator (15332.0)

与えられた任意のオブジェクトと要素をブロックに渡し繰り返し、最初に与えられたオブジェクトを返します。

...返します。

ブロックを省略した場合は Enumerator を返します。

@param obj 任意のオブジェクトを指定します。

//emlist[例][ruby]{
evens = (1..10).each_with_object([]) {|i, a| a << i*2 }
# => [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
//}

@see Enumerator#with_object...

Enumerable#each_with_object(obj) {|(*args), memo_obj| ... } -> object (15232.0)

与えられた任意のオブジェクトと要素をブロックに渡し繰り返し、最初に与えられたオブジェクトを返します。

...返します。

ブロックを省略した場合は Enumerator を返します。

@param obj 任意のオブジェクトを指定します。

//emlist[例][ruby]{
evens = (1..10).each_with_object([]) {|i, a| a << i*2 }
# => [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
//}

@see Enumerator#with_object...