Sha256: 96aa49e0359ae2ac6f767e13f55b348d1a0fc38dd521542896dd2f79c066d30c
Contents?: true
Size: 677 Bytes
Versions: 5
Compression:
Stored size: 677 Bytes
Contents
include Java module BSON class BSON_JAVA # TODO: Pool or cache instances of RubyBSONEncoder so that # we don't create a new one on each call to #serialize. def self.serialize(obj, check_keys=false, move_id=false) raise InvalidDocument, "BSON_JAVA.serialize takes a Hash" unless obj.is_a?(Hash) enc = Java::OrgJbson::RubyBSONEncoder.new(JRuby.runtime, check_keys, move_id) ByteBuffer.new(enc.encode(obj)) end def self.deserialize(buf) dec = Java::OrgBson::BSONDecoder.new callback = Java::OrgJbson::RubyBSONCallback.new(JRuby.runtime) dec.decode(buf.to_s.to_java_bytes, callback) callback.get end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
bson-1.1.5 | lib/bson/bson_java.rb |
bson-1.1.4 | lib/bson/bson_java.rb |
bson-1.1.3 | lib/bson/bson_java.rb |
bson-1.1.2 | lib/bson/bson_java.rb |
bson-1.1.1 | lib/bson/bson_java.rb |