Method: Mongo::Protocol::Message#maybe_compress

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

#maybe_compress(compressor, zlib_compression_level = nil) ⇒ self

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Compress the message, if supported by the wire protocol used and if the command being sent permits compression. Otherwise returns self.

Parameters:

  • compressor (String, Symbol)

    The compressor to use.

  • zlib_compression_level (Integer) (defaults to: nil)

    The zlib compression level to use.

Returns:

  • (self)

    Always returns self. Other message types should override this method.

Since:

  • 2.5.0



112
113
114
# File 'lib/mongo/protocol/message.rb', line 112

def maybe_compress(compressor, zlib_compression_level = nil)
  self
end