module Moped::BSON::Extensions::Integer
Constants
- INT32_MAX
- INT32_MIN
- INT64_MAX
- INT64_MIN
Public Instance Methods
__bson_dump__(io, key)
click to toggle source
# File lib/moped/bson/extensions/integer.rb, line 13 def __bson_dump__(io, key) if self >= INT32_MIN && self <= INT32_MAX io << Types::INT32 io << key.to_bson_cstring io << [self].pack(INT32_PACK) elsif self >= INT64_MIN && self <= INT64_MAX io << Types::INT64 io << key.to_bson_cstring io << [self].pack(INT64_PACK) else raise RangeError.new("MongoDB can only handle 8-byte ints") end end