Module: BSON::Hash::ClassMethods
- Defined in:
- lib/bson/hash.rb
Overview
Instance Method Summary collapse
-
#from_bson(bson) ⇒ Array
Deserialize the hash from BSON.
Instance Method Details
#from_bson(bson) ⇒ Array
Deserialize the hash from BSON.
74 75 76 77 78 79 80 81 82 |
# File 'lib/bson/hash.rb', line 74 def from_bson(bson) hash = new bson.read(4) # Swallow the first four bytes. while (type = bson.readbyte.chr) != NULL_BYTE field = bson.gets(NULL_BYTE).from_bson_string.chop! hash[field] = BSON::Registry.get(type).from_bson(bson) end hash end |