Module: Datadog::Core::Encoding::JSONEncoder

Extended by:
Encoder
Defined in:
lib/datadog/core/encoding.rb

Overview

Encoder for the JSON format

Constant Summary collapse

CONTENT_TYPE =
"application/json"

Class Method Summary collapse

Methods included from Encoder

content_type, decode, encode, join

Class Method Details

.content_type ⇒ Object



42
43
44
# File 'lib/datadog/core/encoding.rb', line 42

def self.content_type
  CONTENT_TYPE
end

.decode(obj) ⇒ Object



50
51
52
# File 'lib/datadog/core/encoding.rb', line 50

def self.decode(obj)
  JSON.parse(obj)
end

.encode(obj) ⇒ Object



46
47
48
# File 'lib/datadog/core/encoding.rb', line 46

def self.encode(obj)
  JSON.dump(obj)
end

.join(encoded_data) ⇒ Object



54
55
56
# File 'lib/datadog/core/encoding.rb', line 54

def self.join(encoded_data)
  "[#{encoded_data.join(",")}]"
end