Class: Rack::Session::Cookie::Base64::JSON
- Inherits:
-
Rack::Session::Cookie::Base64
- Object
- Rack::Session::Cookie::Base64
- Rack::Session::Cookie::Base64::JSON
- Defined in:
- lib/rack/session/cookie.rb
Overview
N.B. Unlike other encoding methods, the contained objects must be a valid JSON composite type, either a Hash or an Array.
Instance Method Summary collapse
Instance Method Details
#decode(str) ⇒ Object
79 80 81 82 |
# File 'lib/rack/session/cookie.rb', line 79 def decode(str) return unless str ::JSON.parse(super(str)) rescue nil end |
#encode(obj) ⇒ Object
75 76 77 |
# File 'lib/rack/session/cookie.rb', line 75 def encode(obj) super(::JSON.dump(obj)) end |