Project

General

Profile

Actions

Bug #21089

open

Missing methods on enumerators created from Enumerator::product and Enumerator::Chain

Added by zetter (Chris Zetter) 10 days ago. Updated 10 days ago.

Status:
Open
Target version:
-
ruby -v:
ruby 3.5.0dev (2025-01-26T08:52:22Z master d4a1a2780c) +PRISM [arm64-darwin24]
[ruby-core:120794]

Description

I was using Enumerator.product and noticed the enumerators it returned were missing the next method.

When looking at the source code, I saw all the stateful enumerator methods were missing (next, peek_values, peek, next_values, feed) as they were removed from the Enumerator::Product subclass with rb_undef_method.

This also applies to instances of Enumerator::Chain, it looks like the methods never worked and were removed in https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/68d028578a5975fe6c44d29c502615ff9af72927

Because the English documentation says Enumerator.product 'Generates a new enumerator object' and the documentation says it inherits from Enumerator I expected it to have the next method available. I can use .to_enum to make the next method available, but I'm not sure why I need to.

I'm unsure if this could be solved by making these available or the documentation could be improved.


Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #18685: Enumerator.product: Cartesian product of enumerablesClosedActions
Actions #1

Updated by nobu (Nobuyoshi Nakada) 10 days ago

  • Related to Feature #18685: Enumerator.product: Cartesian product of enumerables added

Updated by nobu (Nobuyoshi Nakada) 10 days ago

  • Assignee set to knu (Akinori MUSHA)
Actions

Also available in: Atom PDF

Like0
Like0Like0