Sha256: 38b189dfb7673d143012bc6d43b0c50e2e090d1c8901a508aba2205cb1105170

Contents?: true

Size: 449 Bytes

Versions: 4

Compression:

Stored size: 449 Bytes

Contents

require "zlib"
require "stringio"

module Flipper
  module Serializers
    class Gzip
      def self.serialize(source)
        return if source.nil?
        output = StringIO.new
        gz = Zlib::GzipWriter.new(output)
        gz.write(source)
        gz.close
        output.string
      end

      def self.deserialize(source)
        return if source.nil?
        Zlib::GzipReader.wrap(StringIO.new(source), &:read)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
flipper-1.3.2 lib/flipper/serializers/gzip.rb
flipper-1.3.1 lib/flipper/serializers/gzip.rb
flipper-1.3.0 lib/flipper/serializers/gzip.rb
flipper-1.3.0.pre lib/flipper/serializers/gzip.rb