Module: Moped::BSON::Extensions::Array
- Included in:
- Array
- Defined in:
- lib/moped/bson/extensions/array.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#__bson_dump__(io, key) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/moped/bson/extensions/array.rb', line 21 def __bson_dump__(io, key) io << Types::ARRAY io << key.to_bson_cstring start = io.bytesize # write dummy length io << START_LENGTH index, length = 0, self.length while index < length slice(index).__bson_dump__(io, index.to_s) index += 1 end io << EOD stop = io.bytesize io[start, 4] = [stop - start].pack(INT32_PACK) io end |