Actions
Bug #4136
closedEnumerable#reject should not inherit the receiver's instance variables
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.3dev (2010-11-28 trunk 29965) [x86_64-darwin10.5.0]
Backport:
Description
=begin
re
Below, you see that a.reject returns a copy of the receiver, which inherits the instance variable @foo. This is not the case with Array#select.
irb(main):001:0> a=[]
=> []
irb(main):002:0> a.instance_variable_set "@foo", "bar"
=> "bar"
irb(main):003:0> a.reject {}.instance_variable_get "@foo"
=> "bar"
irb(main):004:0> a.select {}.instance_variable_get "@foo"
=> nil
1.8.x behaves the same way.
=end
Actions
Like0
Like0Like0Like0Like0Like0Like0Like0Like0