Project

General

Profile

Actions

Bug #22189

closed

`Enumerator::Lazy#to_enum` does not accept method names as strings

Bug #22189: `Enumerator::Lazy#to_enum` does not accept method names as strings

Added by nobu (Nobuyoshi Nakada) 21 days ago. Updated 17 days ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:125997]

Description

Kernel#to_enum accepts a String as well as a Symbol.

[1,2,3].to_enum(:map).to_a       #=> [1, 2, 3]
[1,2,3].to_enum("map").to_a      #=> [1, 2, 3]
[1,2,3].lazy.to_enum(:map).to_a  #=> [1, 2, 3]
[1,2,3].lazy.to_enum("map").to_a #=> []

Related to [Bug #7877].

Updated by nobu (Nobuyoshi Nakada) 21 days ago Actions #1

  • Status changed from Open to Closed

Applied in changeset git|aaf54aa08b0ed73ae21786b5341f1ffc51659911.


[Bug #22189] Lazy to_enum should accept String method names too

Since lazy_use_super_method is the Symbol-to-Symbol mapping,
convert the given method name to a Symbol before consulting that
table.

Updated by k0kubun (Takashi Kokubun) 17 days ago Actions #2 [ruby-core:126081]

  • Backport changed from 3.3: REQUIRED, 3.4: REQUIRED, 4.0: REQUIRED to 3.3: REQUIRED, 3.4: REQUIRED, 4.0: DONE
Actions

Also available in: PDF Atom