Project

General

Profile

Actions

Bug #9223

closed

Hash#reject!.size does not reflect changes to the hash

Added by dmarcotte (Daniel Marcotte) about 11 years ago. Updated about 11 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 2.0.0p353
[ruby-core:58914]

Description

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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0