Class: Rack::Session::Cookie::Base64::ZipJSON

Inherits:
Rack::Session::Cookie::Base64 show all
Defined in:
lib/rack/session/cookie.rb

Instance Method Summary collapse

Instance Method Details

#decode(str) ⇒ Object



132
133
134
135
136
137
# File 'lib/rack/session/cookie.rb', line 132

def decode(str)
  return unless str
  ::JSON.parse(Zlib::Inflate.inflate(super(str)))
rescue
  nil
end

#encode(obj) ⇒ Object



128
129
130
# File 'lib/rack/session/cookie.rb', line 128

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