Sha256: 6cc21ae5c017cc23f32a6f943e8816f5b50fef2da0b117ed6f5f2659c6a5547b

Contents?: true

Size: 565 Bytes

Versions: 28

Compression:

Stored size: 565 Bytes

Contents

require 'base64'
require 'zlib'

require 'sym/errors'
require 'sym/configuration'

module Sym
  module Data
    class Encoder
      attr_accessor :data, :data_encoded

      def initialize(data, compress)
        self.data         = data
        self.data_encoded = Marshal.dump(data)
        self.data_encoded = Zlib::Deflate.deflate(data_encoded, compression_level) if compress
        self.data_encoded = Base64.urlsafe_encode64(data_encoded)
      end

      def compression_level
        Sym::Configuration.config.compression_level
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
sym-3.0.2 lib/sym/data/encoder.rb
sym-3.0.1 lib/sym/data/encoder.rb
sym-3.0.0 lib/sym/data/encoder.rb
sym-2.10.0 lib/sym/data/encoder.rb
sym-2.8.5 lib/sym/data/encoder.rb
sym-2.8.4 lib/sym/data/encoder.rb
sym-2.8.2 lib/sym/data/encoder.rb
sym-2.8.1 lib/sym/data/encoder.rb
sym-2.8.0 lib/sym/data/encoder.rb
sym-2.7.0 lib/sym/data/encoder.rb
sym-2.6.3 lib/sym/data/encoder.rb
sym-2.6.2 lib/sym/data/encoder.rb
sym-2.6.1 lib/sym/data/encoder.rb
sym-2.6.0 lib/sym/data/encoder.rb
sym-2.5.3 lib/sym/data/encoder.rb
sym-2.5.1 lib/sym/data/encoder.rb
sym-2.5.0 lib/sym/data/encoder.rb
sym-2.4.3 lib/sym/data/encoder.rb
sym-2.3.0 lib/sym/data/encoder.rb
sym-2.2.1 lib/sym/data/encoder.rb