Class: Rack::Protection::EncryptedCookie::Base64::ZipJSON

Inherits:
Rack::Protection::EncryptedCookie::Base64 show all
Defined in:
lib/rack/protection/encrypted_cookie.rb

Instance Method Summary collapse

Instance Method Details

#decode(str) ⇒ Object



115
116
117
118
119
120
121
# File 'lib/rack/protection/encrypted_cookie.rb', line 115

def decode(str)
  return unless str

  ::JSON.parse(Zlib::Inflate.inflate(super(str)))
rescue StandardError
  nil
end

#encode(obj) ⇒ Object



111
112
113
# File 'lib/rack/protection/encrypted_cookie.rb', line 111

def encode(obj)
  super(Zlib::Deflate.deflate(::JSON.dump(obj)))
end