From: "Peña, Botp" Date: 2007-08-17T17:49:58+09:00 Subject: Re: deleting an object in array, based on object.attribute From: Josselin [mailto:josselin@wanadoo.fr] # I have an array anArray = [ object_1, object_2, ...... object_n] # I would like to delete an object in it, if # object.attribute_x = anInteger delete_if changes the array irb(main):055:0> a=["a",1,"b",2,3,"c",4] => ["a", 1, "b", 2, 3, "c", 4] irb(main):056:0> a.delete_if{|x| x.is_a? Integer} => ["a", "b", "c"] irb(main):057:0> a => ["a", "b", "c"] reject creates another array copy irb(main):061:0> a.reject{|x| x.is_a? Integer} => ["a", "b", "c"] select is like reject but w reverse logic irb(main):066:0> a.select{|x| not x.is_a? Integer} => ["a", "b", "c"] kind regards -botp