Sha256: 9958567950147d97719fad368e65038fb4d9a40ef45b5909db51996aa992d619

Contents?: true

Size: 459 Bytes

Versions: 1

Compression:

Stored size: 459 Bytes

Contents

# typed: true
module UpGush
  module PayloadCompression
    module ClassMethods
      def decode(data, options = {})
        decompressed_payload = ActiveSupport::Gzip.decompress(data)
        MultiJson.load(decompressed_payload, options)
      rescue Zlib::GzipFile::Error => e
        # not in gzip format
        MultiJson.load(data, options)
      end
    end

    def self.prepended(mod)
      mod.singleton_class.prepend(ClassMethods)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
up_gush-3.0.0.1 lib/up_gush/payload_compression.rb