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
Methods included from Encoder
content_type, decode, encode, join
Class Method Details
.content_type ⇒ Object
65
66
67
|
# File 'lib/datadog/core/encoding.rb', line 65
def self.content_type
CONTENT_TYPE
end
|
.decode(obj) ⇒ Object
73
74
75
|
# File 'lib/datadog/core/encoding.rb', line 73
def self.decode(obj)
MessagePack.unpack(obj)
end
|
.encode(obj) ⇒ Object
69
70
71
|
# File 'lib/datadog/core/encoding.rb', line 69
def self.encode(obj)
MessagePack.pack(obj)
end
|
.join(encoded_data) ⇒ Object
77
78
79
80
81
82
|
# File 'lib/datadog/core/encoding.rb', line 77
def self.join(encoded_data)
packer = MessagePack::Packer.new
packer.(encoded_data.size)
(packer.buffer.to_a + encoded_data).join
end
|