Bugs item #6090, was opened at 2006-10-10 22:33
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=6090&group_id=426

Category: Core
Group: 1.8.4
Status: Open
Resolution: None
Priority: 3
Submitted By: alex alex (alexttbc)
Assigned to: Nobody (None)
Summary: Loop over array.delete breaks at first hit

Initial Comment:
hi,

first of all, i'm really not quite sure, if this really is a bug since ruby is pretty new to me. but i don't know how to track it further. maybe you know what to do with this.

what i did: i got an array, looped over it and deleted matching items. something like

      for user in @users
        if not Foo.is_foo(user.id)
          @users.delete(user)
        end
      end

first i thought i'd have a bug in my select statements because not all users were filtert. the effect was that the looped breaked at first hit.
then i tried

      @users.delete_if {|user| not Foo.is_foo(user.id) }

which worked fine. i think both versions should do the same.

maybe you know what to do with this. if i made a coding mistake, im sorry for stealing your time.

cheers,
alex

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=6090&group_id=426