Module: Makara::Cookie

Extended by:
Cookie
Included in:
Cookie
Defined in:
lib/makara/cookie.rb

Constant Summary collapse

IDENTIFIER =
'_mkra_stck'.freeze
DEFAULT_OPTIONS =
{
  path: "/",
  http_only: true
}
MAX_AGE_BUFFER =
5

Instance Method Summary collapse

Instance Method Details

#fetch(request) ⇒ Object



14
15
16
# File 'lib/makara/cookie.rb', line 14

def fetch(request)
  parse(request.cookies[IDENTIFIER].to_s)
end

#store(context_data, headers, options = {}) ⇒ Object



18
19
20
21
22
# File 'lib/makara/cookie.rb', line 18

def store(context_data, headers, options = {})
  unless context_data.nil?
    Rack::Utils.set_cookie_header! headers, IDENTIFIER, build_cookie(context_data, options)
  end
end