Class: Prototok::Encoders::Msgpack
- Inherits:
-
Base
- Object
- Base
- Prototok::Encoders::Msgpack
show all
- Defined in:
- lib/prototok/encoders/msgpack.rb
Instance Method Summary
collapse
Methods inherited from Base
#decode, #deserialize, #encode, #initialize, options, #options, #serialize
Instance Method Details
#decode_payload(str) ⇒ Object
18
19
20
|
# File 'lib/prototok/encoders/msgpack.rb', line 18
def decode_payload str
MessagePack.unpack(str)
end
|
#decode_token(str) ⇒ Object
10
11
12
|
# File 'lib/prototok/encoders/msgpack.rb', line 10
def decode_token str
deserialize(MessagePack.unpack(str))
end
|
#encode_payload(payload) ⇒ Object
14
15
16
|
# File 'lib/prototok/encoders/msgpack.rb', line 14
def encode_payload payload
MessagePack.pack payload.to_h
end
|
#encode_token(payload, **header) ⇒ Object
6
7
8
|
# File 'lib/prototok/encoders/msgpack.rb', line 6
def encode_token payload, **
MessagePack.pack serialize(payload, **)
end
|