Sha256: aecb65323c706d15f9deeb41e4c19a787453a4e14f495c4d2ba5f403ce479718
Contents?: true
Size: 776 Bytes
Versions: 16
Compression:
Stored size: 776 Bytes
Contents
module Appsignal class ZippedPayload attr_reader :body def initialize(given_body) @body = Zlib::Deflate.deflate( Appsignal::ZippedPayload.json_generate(given_body), Zlib::BEST_SPEED ) end protected def self.json_generate(given_body) JSON.generate(jsonify(given_body)) end def self.jsonify(value) case value when String value.encode( 'utf-8', :invalid => :replace, :undef => :replace ) when Numeric, NilClass, TrueClass, FalseClass value when Hash Hash[value.map { |k, v| [jsonify(k), jsonify(v)] }] when Array value.map { |v| jsonify(v) } else jsonify(value.to_s) end end end end
Version data entries
16 entries across 16 versions & 1 rubygems