Thank you to everyone who has tried to help me with this today -- I know for
certain -what- the problem is now, after adding in some testing. My Character
class, for whatever reason, is using == to evaluate class. So, when I am
trying to use Array#delete (array.delete(self) for a Character object), it's
deleting every Character object in that array instead of just that single
instance. I've tried to fix this issue by defining the == method in my
Character class like this:
def Character
def == obj
self.equal?(obj)
end
end
However, this doesn't initially work -- I have to reload the file during
runtime for it to utilize the above method. For sake of clarity, this is what
I mean:
Start program...
a = Character.new
b = Character.new
a == b #=> true
Reload character.rb file while program is running...
a == b #=> false
Hopefully that gets my meaning across. I'm not sure why Character#== isn't
initially getting used, or if there's something wrong with my declaration.
I'm also not sure why Character#== (prior to my defining Character#==) is
comparing class and my other classes aren't.
I hope that this description is satisfactory -- and thank you for any help
that can be offered.
-Matt
On Saturday 18 August 2007 14:35, David A. Black wrote: