Module: Mongo::Protocol::Serializers::Int64 Private
- Defined in:
- build/ruby-driver-v2.19/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 64-bit integers.
Serializes and de-serializes one 64-bit integer.
Class Method Summary collapse
-
.deserialize(buffer, options = {}) ⇒ Fixnum
private
Deserializes a 64-bit Fixnum from the IO stream.
-
.serialize(buffer, value, validating_keys = nil) ⇒ String
private
Serializes a number to a 64-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 64-bit Fixnum from the IO stream
169 170 171 |
# File 'build/ruby-driver-v2.19/lib/mongo/protocol/serializers.rb', line 169 def self.deserialize(buffer, = {}) buffer.get_int64 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 64-bit integer
151 152 153 154 155 156 157 158 159 160 161 |
# File 'build/ruby-driver-v2.19/lib/mongo/protocol/serializers.rb', line 151 def self.serialize(buffer, value, validating_keys = nil) if value.is_a?(BSON::Int64) if value.respond_to?(:value) # bson-ruby >= 4.6.0 value = value.value else value = value.instance_variable_get('@integer') end end buffer.put_int64(value) end |