Method: Mongo::Protocol::Registry#get

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

#get(op_code, message = nil) ⇒ Class

Get the class for the given op code and raise an error if it’s not found.

Examples:

Get the type for the op code.

Mongo::Protocol::Registry.get(1)

Returns:

  • (Class)

    The corresponding Ruby class for the message type.

Since:

  • 2.5.0



41
42
43
44
45
46
47
# File 'lib/mongo/protocol/registry.rb', line 41

def get(op_code, message = nil)
  if type = MAPPINGS[op_code]
    type
  else
    handle_unsupported_op_code!(op_code)
  end
end