Module: Mongoid::Equality::ClassMethods

Defined in:
build/mongoid-7.4/lib/mongoid/equality.rb

Instance Method Summary collapse

Instance Method Details

#===(other) ⇒ true, false

Performs class equality checking.

Examples:

Compare the classes.

document === other

Parameters:

  • other (Document, Object)

    The other object to compare with.

Returns:

  • (true, false)

    True if the classes are equal, false if not.



74
75
76
77
78
79
80
# File 'build/mongoid-7.4/lib/mongoid/equality.rb', line 74

def ===(other)
  if Mongoid.legacy_triple_equals
    other.is_a?(self)
  else
    other.class == Class ? self <= other : other.is_a?(self)
  end
end