Sha256: 6a904edaa16fb98ae7e5e90e3c01390def44e520c630153b32ca9097eb1891e8

Contents?: true

Size: 448 Bytes

Versions: 5

Compression:

Stored size: 448 Bytes

Contents

# A thin wrapper for the CBson class
module BSON
  class BSON_C

    def self.serialize(obj, check_keys=false, move_id=false)
      ByteBuffer.new(CBson.serialize(obj, check_keys, move_id))
    end

    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

  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
bson-1.0 lib/bson/bson_c.rb
bson-0.20.1 lib/bson/bson_c.rb
bson-0.20 lib/bson/bson_c.rb
mongo-0.19.3 lib/bson/bson_c.rb
mongo-0.19.2 lib/bson/bson_c.rb