Deleting an object from an array

I assumed incorrectly that Array#delete deleted a specific object,
using eql? (identity). I later discovered that it uses == (same
values). Then I looked for a method to delete using eql? and couldn't
find one. I ended up using the following. Is there a better way?

  obj_to_delete = whatever
  my_array.delete_if { |element| element.eql?(object_to_delete) }

···

--
R. Mark Volkmann
Object Computing, Inc.

probably not, but if you're doing alot of this kind of override you might to

   class IndentArray < ::Array
     alias_method "==", "eql?"
   end

etc.

-a

···

On Mon, 3 Apr 2006, Mark Volkmann wrote:

I assumed incorrectly that Array#delete deleted a specific object,
using eql? (identity). I later discovered that it uses == (same
values). Then I looked for a method to delete using eql? and couldn't
find one. I ended up using the following. Is there a better way?

obj_to_delete = whatever
my_array.delete_if { |element| element.eql?(object_to_delete) }

--
share your knowledge. it's a way to achieve immortality.
- h.h. the 14th dali lama