Class: Secrets::Data::Decoder
- Inherits:
-
Object
- Object
- Secrets::Data::Decoder
- Defined in:
- lib/secrets/data/decoder.rb
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.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/secrets/data/decoder.rb', line 9 def initialize(data_encoded, compress) self.data_encoded = data_encoded self.data = Base64.urlsafe_decode64(data_encoded) 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 |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
7 8 9 |
# File 'lib/secrets/data/decoder.rb', line 7 def data @data end |
#data_encoded ⇒ Object
Returns the value of attribute data_encoded.
7 8 9 |
# File 'lib/secrets/data/decoder.rb', line 7 def data_encoded @data_encoded end |