Module: CaTissue::HashCode
- Included in:
- CollectionProtocol, CollectionProtocolEvent, StorageType
- Defined in:
- lib/catissue/domain/hash_code.rb
Overview
This HashCode mix-in overrides the caTissue hashCode and equality test to work around caTissue bugs.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Returns whether other is of type same type as this object with the same hash as this object.
-
#hash ⇒ Integer
caTissue alert - caTissue hashCode changes with identifier assignment.
Instance Method Details
#==(other) ⇒ Boolean
Returns whether other is of type same type as this object with the same hash as this object.
caTissue alert - Bug #70: caTissue equal returns true for class mismatch.
22 23 24 |
# File 'lib/catissue/domain/hash_code.rb', line 22 def ==(other) equal?(other) end |
#hash ⇒ Integer
caTissue alert - caTissue hashCode changes with identifier assignment. This leads to ugly cascading errors when used in a Set or Hash.
9 10 11 12 13 |
# File 'lib/catissue/domain/hash_code.rb', line 9 def hash # JRuby alert - JRuby 1.5 object_id can be a String, e.g. CollectionProtocol_null. # Work-around to the work-around is to make a unique object id in this aberrant case. @_hc ||= (Object.new.object_id * 31) + 17 end |