Module: TingYun::Support::Serialize::Encoders::Base64CompressedJSON

Defined in:
lib/ting_yun/support/serialize/encodes.rb

Class Method Summary collapse

Class Method Details

.encode(data, opts = {}) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/ting_yun/support/serialize/encodes.rb', line 25

def self.encode(data, opts={})
  normalize_encodings = if opts[:skip_normalization]
                          false
                        else
                          TingYun::Agent.config[:normalize_json_string_encodings]
                        end
  json = JSONWrapper.dump(data, :normalize => normalize_encodings)
  Base64.encode64(Compressed.encode(json))
end