Sha256: b482b75253303c7188f3113556da5f1f14130f037acea267559c7ff40aed3d0f

Contents?: true

Size: 635 Bytes

Versions: 10

Compression:

Stored size: 635 Bytes

Contents

require_relative '../errors'
require 'base64'
require 'zlib'
module Shhh
  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
shhh-1.7.0 lib/shhh/data/decoder.rb
shhh-1.6.5 lib/shhh/data/decoder.rb
shhh-1.6.4 lib/shhh/data/decoder.rb
shhh-1.6.3 lib/shhh/data/decoder.rb
shhh-1.6.2 lib/shhh/data/decoder.rb
shhh-1.6.1 lib/shhh/data/decoder.rb
shhh-1.5.4 lib/shhh/data/decoder.rb
shhh-1.4.1 lib/shhh/data/decoder.rb
shhh-1.4.0 lib/shhh/data/decoder.rb
shhh-1.3.0 lib/shhh/data/decoder.rb