Module: Datadog::Core::Encoding::MsgpackEncoder
- Extended by:
- Encoder
- Defined in:
- lib/datadog/core/encoding.rb
Overview
Encoder for the Msgpack format
Constant Summary collapse
- CONTENT_TYPE =
'application/msgpack'
Class Method Summary collapse
Class Method Details
.content_type ⇒ Object
69 70 71 |
# File 'lib/datadog/core/encoding.rb', line 69 def content_type CONTENT_TYPE end |
.decode(obj) ⇒ Object
77 78 79 |
# File 'lib/datadog/core/encoding.rb', line 77 def decode(obj) MessagePack.unpack(obj) end |
.encode(obj) ⇒ Object
73 74 75 |
# File 'lib/datadog/core/encoding.rb', line 73 def encode(obj) MessagePack.pack(obj) end |
.join(encoded_data) ⇒ Object
81 82 83 84 85 86 |
# File 'lib/datadog/core/encoding.rb', line 81 def join(encoded_data) packer = MessagePack::Packer.new packer.write_array_header(encoded_data.size) (packer.buffer.to_a + encoded_data).join end |