Module: Lafcadio::DomainComparable

Includes:
Comparable
Included in:
DomainObject, DomainObjectProxy
Defined in:
lib/lafcadio/objectStore/DomainComparable.rb

Instance Method Summary collapse

Instance Method Details

#<=>(anOther) ⇒ Object

A DomainObject or DomainObjectProxy is compared by objectType and by pkId.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/lafcadio/objectStore/DomainComparable.rb', line 7

def <=>(anOther)
	if anOther.respond_to?( 'objectType' )
		if self.objectType == anOther.objectType
			self.pkId <=> anOther.pkId
		else
			self.objectType.name <=> anOther.objectType.name
		end
	else
		nil
	end
end

#eql?(otherObj) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/lafcadio/objectStore/DomainComparable.rb', line 19

def eql?(otherObj)
	self == otherObj
end

#hashObject



23
# File 'lib/lafcadio/objectStore/DomainComparable.rb', line 23

def hash; "#{ self.class.name } #{ pkId }".hash; end