From: Hiro Asari Date: 2010-12-09T03:37:18+09:00 Subject: [ruby-core:33640] [Ruby 1.9-Bug#4136][Open] Enumerable#reject should not inherit the receiver's instance variables Bug #4136: Enumerable#reject should not inherit the receiver's instance variables http://redmine.ruby-lang.org/issues/show/4136 Author: Hiro Asari Status: Open, Priority: Normal ruby -v: ruby 1.9.3dev (2010-11-28 trunk 29965) [x86_64-darwin10.5.0] 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. ---------------------------------------- http://redmine.ruby-lang.org