Module: MiniMongo::Comparable
Instance Method Summary collapse
-
#<=>(other) ⇒ Integer
Default comparison is via the string version of the id.
-
#===(other) ⇒ true, false
Performs class equality checking.
-
#eql?(other) ⇒ true, false
Delegates to ==.
Instance Method Details
#<=>(other) ⇒ Integer
Default comparison is via the string version of the id.
13 14 15 |
# File 'lib/mini_mongo/comparable.rb', line 13 def <=>(other) attributes["id"] <=> other.attributes["id"] end |
#===(other) ⇒ true, false
Performs class equality checking.
25 26 27 |
# File 'lib/mini_mongo/comparable.rb', line 25 def ===(other) other.class == Class ? self.class === other : self == other end |
#eql?(other) ⇒ true, false
Delegates to ==. Used when needing checks in hashes.
37 38 39 |
# File 'lib/mini_mongo/comparable.rb', line 37 def eql?(other) self == (other) end |