Sha256: f4be10dcc0d0834803763a12107b8f7dbecfe26954c60c890129bf6305ff1179

Contents?: true

Size: 634 Bytes

Versions: 10

Compression:

Stored size: 634 Bytes

Contents

require_relative '../errors'
require 'base64'
require 'zlib'
module Sym
  module Data
    class Decoder
      attr_accessor :data, :data_encoded, :data

      def initialize(data_encoded, compress)
        self.data_encoded = data_encoded
        self.data         = begin
          Base64.urlsafe_decode64(data_encoded)
        rescue
          data_encoded
        end

        if compress.nil? || compress # auto-guess
          self.data = begin
            Zlib::Inflate.inflate(data)
          rescue Zlib::Error => e
            data
          end
        end
        self.data = Marshal.load(data)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
sym-2.3.0 lib/sym/data/decoder.rb
sym-2.2.1 lib/sym/data/decoder.rb
sym-2.2.0 lib/sym/data/decoder.rb
sym-2.1.2 lib/sym/data/decoder.rb
sym-2.1.1 lib/sym/data/decoder.rb
sym-2.1.0 lib/sym/data/decoder.rb
sym-2.0.3 lib/sym/data/decoder.rb
sym-2.0.2 lib/sym/data/decoder.rb
sym-2.0.1 lib/sym/data/decoder.rb
sym-2.0.0 lib/sym/data/decoder.rb