Sha256: f015689fc359c3073a28f2269a08f5af12e1857c2d3f47568ae85f9b6fb938a0

Contents?: true

Size: 627 Bytes

Versions: 18

Compression:

Stored size: 627 Bytes

Contents

require 'sym/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

18 entries across 18 versions & 1 rubygems

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