Project

General

Profile

Feature #17116

Updated by S_H_ (Shun Hiraoka) over 3 years ago

Now, `Enumerator#new` is allow this code(no given blocks). 

 ```ruby 
 obj = Object.new 
 Enumerator.new(obj) 
 ``` 

 But, warning is displayed(since `ruby-2.0.0-preview2`). 


 ```bash 
 -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 given. 

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

Back