From: "naruse (Yui NARUSE)" Date: 2013-12-17T01:27:00+09:00 Subject: [ruby-core:59143] [ruby-trunk - Bug #9223] Hash#reject!.size does not reflect changes to the hash Issue #9223 has been updated by naruse (Yui NARUSE). NEWS says +* Hash + * incompatible changes: + * Hash#reject now returns plain Hash object, that is the original object's + subclass, instance variables, default value, and taintedness are no longer + copied. but test/ruby/test_hash.rb checks assert_instance_of(Hash, h) ---------------------------------------- Bug #9223: Hash#reject!.size does not reflect changes to the hash https://bugs.ruby-lang.org/issues/9223#change-43705 Author: dmarcotte (Daniel Marcotte) Status: Assigned Priority: Immediate Assignee: matz (Yukihiro Matsumoto) Category: core Target version: current: 2.1.0 ruby -v: ruby 2.0.0p353 Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN Here's an example demonstrating the issue, comparing to the regular reject behavior: h = {a: 'A', b: 'B'} reject_enum = h.reject reject_bang_enum = h.reject! h[:c] = 'C' p reject_enum.size # 3 p reject_bang_enum.size # 2 -- http://bugs.ruby-lang.org/