class Telemetry::Outgoing::Message

Public Class Methods

new(obj,annotations={}) click to toggle source
# File lib/telemetry/message.rb, line 42
def initialize(obj,annotations={})
    @annotations = annotations
    @data = obj
end

Public Instance Methods

serialize() click to toggle source
# File lib/telemetry/message.rb, line 47
def serialize
    msg = MessageBase.new
    msg.data = if data.is_a?(::Typelib::Type)
                   annotations[:type] ||= :typelib
                   annotations[:type_name] ||= data.class.name
                   Base64.encode64(data.to_byte_array)
               else
                   data.to_s
               end
    msg.annotations = annotations
    msg.serialize
end