Messages::Attachment
Inherits BSON::Serializable < Struct < Value < Object
Constructors
new(filename : String, bytes : Slice(UInt8))
Sourcenew(bson : BSON)
Allocate an instance and copies data from a BSON struct.
class User
include BSON::Serializable
property name : String
end
data = BSON.new
data["name"] = "John"
User.new(data)
Class methods
Instance methods
bytes
Sourcebytes=(bytes : Bytes)
Sourcefilename
Sourcefilename=(filename : String)
Sourceto_bson(bson = BSON.new)
Converts to a BSON representation.
user = User.new name: "John"
bson = user.to_bson