do to_a if it's not a string
This commit is contained in:
parent
3a3109e7dc
commit
765ed9334e
|
@ -134,7 +134,11 @@ class BSON
|
||||||
def deserialize(buf=nil, parent=nil)
|
def deserialize(buf=nil, parent=nil)
|
||||||
# If buf is nil, use @buf, assumed to contain already-serialized BSON.
|
# If buf is nil, use @buf, assumed to contain already-serialized BSON.
|
||||||
# This is only true during testing.
|
# This is only true during testing.
|
||||||
|
if buf.is_a? String
|
||||||
@buf = ByteBuffer.new(buf) if buf
|
@buf = ByteBuffer.new(buf) if buf
|
||||||
|
else
|
||||||
|
@buf = ByteBuffer.new(buf.to_a) if buf
|
||||||
|
end
|
||||||
@buf.rewind
|
@buf.rewind
|
||||||
@buf.get_int # eat message size
|
@buf.get_int # eat message size
|
||||||
doc = OrderedHash.new
|
doc = OrderedHash.new
|
||||||
|
|
Loading…
Reference in New Issue