Method: Mongo::Protocol::Message#==

Defined in:
lib/mongo/protocol/message.rb

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

Tests for equality between two wire protocol messages by comparing class and field values.

Parameters:

Returns:

  • (true, false)

    The equality of the messages.



295
296
297
298
299
300
301
302
# File 'lib/mongo/protocol/message.rb', line 295

def ==(other)
  return false if self.class != other.class
  fields.all? do |field|
    name = field[:name]
    instance_variable_get(name) ==
      other.instance_variable_get(name)
  end
end