class Rack::Session::Cookie::Base64::JSON - rack-1.6.2 Documentation

# class Rack::Session::Cookie::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
Calls superclass method Rack::Session::Cookie::Base64#decode

    # File lib/rack/session/cookie.rb, line 77
    def decode(str)
      return unless str
      ::Rack::Utils::OkJson.decode(super(str)) rescue nil
    end

encode(obj) click to toggle source
Calls superclass method Rack::Session::Cookie::Base64#encode

    # File lib/rack/session/cookie.rb, line 73
    def encode(obj)
      super(::Rack::Utils::OkJson.encode(obj))
    end