Project

General

Profile

Bug #15455

Updated by CaryInVictoria (Cary Swoveland) over 5 years ago

 RUBY VERSION: 2.6.0 (2018-12-23 patchlevel -1) 

 `a = [1, 2, 3]` 

 `a.each_with_object([])      #=> #<Enumerator: [1, 2, 3]:each_with_object([])> 
 a.each_with_object(1..3)     #=> #<Enumerator: [1, 2, 3]:each_with_object(1..3)> 
 a.each_with_object("cat") #=> #<Enumerator: [1, 2, 3]:each_with_object("cat")>` 

 So far so good. But there is a problem when with the object is a hash. 
 
 `a.each_with_object({}) #=> #<Enumerator: [1, 2, 3]:each_with_objec)> 
 a.each_with_object(Hash.new(0)) #=> #<Enumerator: [1, 2, 3]:each_with_objec)> 
 a.each.with_object(Hash.new(0)) #=> #<Enumerator: #<Enumerator: [1, 2, 3]:each>:with_objec)>` 

 This problem does not occur with v2.5.3.

Back