From d79551eaa80a51dea1034da50493c7e6cbbc00be Mon Sep 17 00:00:00 2001 From: Jim Menard Date: Tue, 16 Dec 2008 07:07:29 -0500 Subject: [PATCH] start of BSON tests; removed unused BSON ivar --- lib/mongo/util/bson.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/mongo/util/bson.rb b/lib/mongo/util/bson.rb index 8f38322..107dec8 100644 --- a/lib/mongo/util/bson.rb +++ b/lib/mongo/util/bson.rb @@ -31,7 +31,6 @@ class BSON end def initialize - @private_buf = ByteBuffer.new @buf = ByteBuffer.new end @@ -78,8 +77,10 @@ class BSON self end - def deserialize(buf) - @buf = ByteBuffer.new(buf.to_a) + def deserialize(buf=nil) + # If buf is nil, use @buf, assumed to contain already-serialized BSON. + # This is only true during testing. + @buf = ByteBuffer.new(buf.to_a) if buf @buf.rewind @buf.get_int # eat message size doc = {}