------ art_81392_30921896.1157080092736
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
I have a class defined as:
###########################
class MyClass
def initialize(s1, s2, s3)
@string1 1
@string2 2
@string3 3
end
def hash
return (@string1 + @string2 + @string3).hash
end
end
###########################
Then I create two instances of this class:
###########################
obj1 yClass.new('a', 'b', 'c')
obj2 yClass.new('a', 'b', 'c')
###########################
If verify obj1 and obj2 do have the same hash value, I check that
'obj1.hash obj2.hash'
returns true
Now i try to use those objects as hash key:
h[obj1] abc'
h[obj2] def'
I expected h contains only one item with value 'def', since obj1 and obj2
have the same hash value. But it turns out it has 2 items instead.
Did I miss something?
------ art_81392_30921896.1157080092736--