Method: Sym::Data::Decoder#initialize
- Defined in:
- lib/sym/data/decoder.rb
#initialize(data_encoded, compress) ⇒ Decoder
Returns a new instance of Decoder.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sym/data/decoder.rb', line 9 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 |