Module: GrpcKit::Transport::Packable
- Included in:
- ClientTransport, ServerTransport
- Defined in:
- lib/grpc_kit/transport/packable.rb
Defined Under Namespace
Classes: Unpacker
Instance Method Summary collapse
Instance Method Details
#pack(data, compress = false) ⇒ String
Returns packed value.
9 10 11 12 |
# File 'lib/grpc_kit/transport/packable.rb', line 9 def pack(data, compress = false) c = compress ? 1 : 0 [c, data.bytesize, data].pack('CNa*') end |
#unpack(data) ⇒ String
16 17 18 19 20 |
# File 'lib/grpc_kit/transport/packable.rb', line 16 def unpack(data) unpacker.feed(data) if data unpacker.read end |