class Rack::Protection::EncryptedCookie::Base64::JSON

N.B. Unlike other encoding methods, the contained objects must be a valid JSON composite type, either a Hash or an Array.

Public Instance Methods

decode(str) click to toggle source
# File lib/rack/protection/encrypted_cookie.rb, line 99
def decode(str)
  return unless str

  begin
    ::JSON.parse(super(str))
  rescue StandardError
    nil
  end
end
encode(obj) click to toggle source
# File lib/rack/protection/encrypted_cookie.rb, line 95
def encode(obj)
  super(::JSON.dump(obj))
end