Class: Sym::Data::Decoder
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#data_encoded ⇒ Object
Returns the value of attribute data_encoded.
Instance Method Summary collapse
-
#initialize(data_encoded, compress) ⇒ Decoder
constructor
A new instance of Decoder.
Constructor Details
#initialize(data_encoded, compress) ⇒ Decoder
Returns a new instance of Decoder.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/sym/data/decoder.rb', line 10 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 |