3 alias :case_equal? :===
5 def ===(other, counter = [0], my_rec = {}, his_rec = {}) # !> method redefined; discarding old eql?
6 return true if other.object_id == self.object_id
7 return false unless other.is_a? Array
8 return true if other == self
9 return false unless other.size == self.size
12 my_rec[object_id] = his_rec[other.object_id] = counter[0]
15 x, y = self[i], other[i]
16 xid, yid = x.object_id, y.object_id
17 if x.is_a? Array and y.is_a? Array
18 recursive = my_rec[xid] || his_rec[yid]
19 if recursive && my_rec[xid] != his_rec[yid]
21 elsif recursive # matches because the two arrays have same object_id
23 else # not recursive, just compare normally
24 return false unless x.===(y, counter, my_rec, his_rec)
27 # if x is an Array, but y is not
31 return false unless x === y