Project

General

Profile

Actions

Feature #17116

closed

raise ArgumentError in Enumerator#new in no given blocks

Added by S_H_ (Shun Hiraoka) over 3 years ago. Updated over 3 years ago.

Status:
Closed
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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0