Class: BSON_C
Overview
A thin wrapper for the CBson class
Class Method Summary collapse
Class Method Details
.deserialize(buf = nil) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/mongo/util/bson_c.rb', line 8 def self.deserialize(buf=nil) if buf.is_a? String to_deserialize = ByteBuffer.new(buf) if buf else buf = ByteBuffer.new(buf.to_a) if buf end buf.rewind CBson.deserialize(buf.to_s) end |
.serialize(obj, check_keys = false, move_id = false) ⇒ Object
4 5 6 |
# File 'lib/mongo/util/bson_c.rb', line 4 def self.serialize(obj, check_keys=false, move_id=false) ByteBuffer.new(CBson.serialize(obj, check_keys, move_id)) end |