Methods

Class/Module Index [+]

Quicksearch

Moped::BSON::Extensions::Integer

Public Instance Methods

__bson_dump__(io, key) click to toggle source
# File lib/moped/bson/extensions/integer.rb, line 18
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

[Validate]

Generated with the Darkfish Rdoc Generator 2.