るりまサーチ

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

別のキーワード

  1. objectspace each_object
  2. _builtin each_object
  3. object send
  4. object enum_for
  5. object to_enum

ライブラリ

クラス

検索結果

Enumerator#feed(obj) -> nil (18226.0)

Enumerator 内部の yield が返す値を設定します。

...す。

これで値を設定しなかった場合は yield は nil を返します。

この値は内部で yield された時点でクリアされます。

//emlist[例][ruby]{
# (1), (2), ... (10) の順に実行される
o = Object.new
def o.each
x = yield # (2) blocks
p x...
...# (5) => "foo"
x = yield # (6) blocks
p x # (8) => nil
x = yield # (9) blocks
p x # not reached w/o another e.next
end

e = o.to_enum
e.next # (1)
e.feed "foo" # (3)
e.next # (4)
e.next # (7)...