Methods

Class/Module Index [+]

Quicksearch

Moped::BSON::Extensions::Hash

Public Instance Methods

__bson_dump__(io = "", key = nil) click to toggle source
# File lib/moped/bson/extensions/hash.rb, line 24
def __bson_dump__(io = "", key = nil)
  if key
    io << Types::HASH
    io << key.to_bson_cstring
  end

  start = io.bytesize

  # write dummy length
  io << START_LENGTH

  each do |k, v|
    v.__bson_dump__(io, k.to_s)
  end
  io << EOD

  stop = io.bytesize
  io[start, 4] = [stop - start].pack INT32_PACK

  io
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.