Sha256: 17e5913e72e6c75ebe8bd58e3c0c564006b36a415d7e42d0d13230d737928ca6
Contents?: true
Size: 576 Bytes
Versions: 5
Compression:
Stored size: 576 Bytes
Contents
require 'zlib' require 'stringio' module SerializableAttributes module Format module ActiveSupportJson extend self def encode(body) return nil if body.blank? s = StringIO.new z = Zlib::GzipWriter.new(s) z.write ActiveSupport::JSON.encode(body) z.close s.string end def decode(body) return {} if body.to_s.empty? s = StringIO.new(body) z = Zlib::GzipReader.new(s) hash = ActiveSupport::JSON.decode(z.read) z.close hash end end end end
Version data entries
5 entries across 5 versions & 1 rubygems