I went a little different route, but that was indeed the problem. I just defined == in my class, which I guess was comparing the class of the object instead of the object_id. I did: def == obj self.equal?(obj) end If you have time, or if someone else does, is there a quick explanation of why this happened in this instance, but not with similar classes that function fine with essentially duplicate methods of adding to and deleting from arrays? Hopefully I can avoid future problems if I understand what's happening (I'm a hobby programmer, so I lack some technical expertise). Thank you, and the other repliers, for the help -- it's very much appreciated. -Matt On Saturday 18 August 2007 05:09, Robert Klemme wrote: > On 18.08.2007 08:34, Matthew B Gardner wrote: > > Sorry, I only meant the code I posted as an example of what is happening > > -- the actual code would be a little hard to gather and format, but I > > will do so if the following isn't enough information: > > > > ruby -v #=> ruby 1.8.4 (2005-12-24) [i486-linux] > > > > Ok, I threw this code in to gather some info, and following it is the > > printout: > > > > p world.characters.class > > p world.characters.size > > world.characters.each do |ch| > > p ch.class > > p ch.object_id > > end > > world.characters.delete(self) > > p world.characters > > > > Array > > 2 > > Character > > -607336504 > > Character > > -607410834 > > [] > > > > Do I need to format up the code, or is there something telling from the > > information here? > > The crucial bit is missing: how did you define ==, eql? and hash in your > class? Did you define them? If not, using Struct might help because > that gives you those methods for free: > > YourClass = Struct.new :name, :other_field do > def method_you_need > end > end > > Then eql?, == and hash will be implemented in terms of "name" and > "other_field". > > Kind regards > > robert