Ruby 3.4 リファレンスマニュアル

singleton method Enumerator::Product.new

new(*enums) -> Enumerator::ProductRuby 3.2 から[permalink][rdoc][edit]

与えた Enumerable なオブジェクトの直積を列挙する Enumerator を作って返します。

[PARAM] enums:
直積を取る Enumerable なオブジェクトを指定します。
e = Enumerator::Product.new(1..3, [4, 5])
p e.to_a # => [[1, 4], [1, 5], [2, 4], [2, 5], [3, 4], [3, 5]]
p e.size # => 6

[SEE_ALSO] Enumerator.product