Int32 — Documentation by YARD 0.9.37 (original) (raw)
Module: Mongo::Protocol::Serializers::Int32Private
Defined in:
lib/mongo/protocol/serializers.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
MongoDB wire protocol serialization strategy for 32-bit integers.
Serializes and de-serializes one 32-bit integer.
Class Method Summarycollapse
- .deserialize(buffer, options = {}) ⇒ Fixnum private
Deserializes a 32-bit Fixnum from the IO stream. - .serialize(buffer, value, validating_keys = nil) ⇒ String private
Serializes a number to a 32-bit integer.
Class Method Details
.deserialize(buffer, options = {}) ⇒ Fixnum
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.
Deserializes a 32-bit Fixnum from the IO stream
135 136 137 | # File 'lib/mongo/protocol/serializers.rb', line 135 def self.deserialize(buffer, options = {}) buffer.get_int32 end |
---|
.serialize(buffer, value, validating_keys = nil) ⇒ String
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.
Serializes a number to a 32-bit integer
117 118 119 120 121 122 123 124 125 126 127 | # File 'lib/mongo/protocol/serializers.rb', line 117 def self.serialize(buffer, value, validating_keys = nil) if value.is_a?(BSON::Int32) if value.respond_to?(:value) value = value.value else value = value.instance_variable_get('@integer') end end buffer.put_int32(value) end |
---|