Module: BSON::Hash::ClassMethods
- Defined in:
- lib/bson/hash.rb
Overview
Instance Method Summary collapse
-
#from_bson(buffer) ⇒ Array
Deserialize the hash from BSON.
Instance Method Details
#from_bson(buffer) ⇒ Array
Deserialize the hash from BSON.
79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/bson/hash.rb', line 79 def from_bson(buffer) if buffer.respond_to?(:get_hash) buffer.get_hash else hash = Document.allocate buffer.get_int32 # Throw away the size. while (type = buffer.get_byte) != NULL_BYTE field = buffer.get_cstring hash.store(field, BSON::Registry.get(type, field).from_bson(buffer)) end hash end end |