Ruby 1.9.2 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Enumerableモジュール > each_entry
each_entry -> Enumeratoreach_entry {|obj| block} -> selfCalls <i>block</i> once for each element in <i>self</i>, passing that element as a parameter, converting multiple values from yield to an array.
class Foo
include Enumerable
def each
yield 1
yield 1,2
end
end
Foo.new.each_entry{|o| print o, " -- "}
produces:
1 -- [1, 2] --