protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Ruby: Convert Protocol::MyType to byte[]

Open aniketdivekar opened this issue 8 years ago • 2 comments

Hi, How can I convert the protobuf object of custom type to byte array? I have this autogenerated module called protocol

module ProtoCol
    MyType = Google::Protobuf::DescriptorPool.generated_pool.lookup("protocol.MyType").msgclass
end

how can I get byte array of Protocol::MyType object?

aniketdivekar avatar Jun 26 '18 16:06 aniketdivekar

I don't understand your question. What do you mean by converting to byte[]. Encode?

TeBoring avatar Jun 28 '18 06:06 TeBoring

@TeBoring Closing it. I had to do object.to_proto.to_s.

aniketdivekar avatar Jul 13 '18 05:07 aniketdivekar