Method: BSON::ObjectId#==

Defined in:
lib/bson/object_id.rb

#==(other) ⇒ true, false Also known as: eql?

Check equality of the object id with another object.

Examples:

Check if the object id is equal to the other.

object_id == other

Parameters:

  • other (Object)

    The object to check against.

Returns:

  • (true, false)

    If the objects are equal.

Since:

  • 2.0.0



42
43
44
45
46
# File 'lib/bson/object_id.rb', line 42

def ==(other)
  return false unless other.is_a?(ObjectId)

  generate_data == other.send(:generate_data)
end