Module: Moped::BSON::Extensions::Hash::ClassMethods
- Included in:
- Hash
- Defined in:
- lib/moped/bson/extensions/hash.rb
Instance Method Summary collapse
Instance Method Details
#__bson_load__(io, doc = new) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/moped/bson/extensions/hash.rb', line 8 def __bson_load__(io, doc = new) # Swallow the first four (length) bytes io.read 4 while (buf = io.readbyte) != 0 key = io.gets(NULL_BYTE).from_utf8_binary.chop! if native_class = Types::MAP[buf] doc[key] = native_class.__bson_load__(io) end end doc end |