module BSON::LogStashEvent::ClassMethods

Public Instance Methods

from_bson(buffer) click to toggle source

Deserialize the Event from BSON. @param [ ByteBuffer ] buffer The byte buffer. @return [ Event ] The decoded bson document. @see bsonspec.org/#/specification

# File lib/logstash/outputs/bson/logstash_event.rb, line 58
def from_bson(buffer)
  hash = Hash.new
  buffer.get_int32 # Throw away the size.
  while (type = buffer.get_byte) != NULL_BYTE
    field = buffer.get_cstring
    hash.store(field, BSON::Registry.get(type).from_bson(buffer))
  end
  new(hash)
end