Class: BSON::Store

Inherits:
PStore
  • Object
show all
Defined in:
lib/bson/store.rb

Constant Summary collapse

VERSION =
"0.1.0"

Instance Method Summary collapse

Instance Method Details

#dump(table) ⇒ Object



23
# File 'lib/bson/store.rb', line 23

def dump(table)            = table.to_bson.to_s

#empty_marshal_checksumObject



25
# File 'lib/bson/store.rb', line 25

def empty_marshal_checksum = CHECKSUM_ALGO.digest(empty_marshal_data)

#empty_marshal_dataObject



24
# File 'lib/bson/store.rb', line 24

def empty_marshal_data     = BSON::Document.new.to_bson.to_s

#load(content) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/bson/store.rb', line 27

def load(content)
  content = content.respond_to?(:read) ? content.read : content
  content.empty? and return BSON::Document.new

  buf = BSON::ByteBuffer.new(content)
  BSON::Document.from_bson(buf)
end