Project

General

Profile

Feature #17116

raise ArgumentError in Enumerator#new in no given blocks

Added by S_H_ (Shun Hiraoka) 5 months ago. Updated 29 days ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-dev:50945]

Description

Currently, Enumerator#new allows this code (no block given):

obj = Object.new
Enumerator.new(obj)

with a warning (since ruby-2.0.0-preview2):

-e:1: warning: Enumerator.new without a block is deprecated; use Object#to_enum instead

I think it's okay to remove this behaviour.
And I think that it seems natural to raise ArgumentError if no block is given.

pull request:
https://github.com/ruby/ruby/pull/3408

#1

Updated by S_H_ (Shun Hiraoka) 5 months ago

  • Description updated (diff)
#2

Updated by sawa (Tsuyoshi Sawada) 5 months ago

  • Description updated (diff)
#3

Updated by shyouhei (Shyouhei Urabe) 29 days ago

  • Status changed from Open to Closed

Applied in changeset git|fa356a798aefc20725467d4fad02df8325d63e71.


Enumerator.new: raise unless block given

Has been deprecated since c73b6bd7ebd01133538c645566944132dbde4d13.
[Feature #17116] [ruby-dev:50945]

Also available in: Atom PDF