Class: Dpop::CookieJar
- Inherits:
-
Object
show all
- Defined in:
- lib/dpop/cookie_jar.rb
Overview
Defined Under Namespace
Classes: InvalidCookieError
Instance Method Summary
collapse
Constructor Details
#initialize(encryptor, request_cookies) ⇒ CookieJar
Returns a new instance of CookieJar.
13
14
15
16
|
# File 'lib/dpop/cookie_jar.rb', line 13
def initialize(encryptor, request_cookies)
@encryptor = encryptor
@request_cookies = request_cookies
end
|
Instance Method Details
#[](cookie_name) ⇒ Object
22
23
24
|
# File 'lib/dpop/cookie_jar.rb', line 22
def [](cookie_name)
try_decrypt(cookie_name)
end
|
#[]=(cookie_name, value) ⇒ Object
26
27
28
29
|
# File 'lib/dpop/cookie_jar.rb', line 26
def []=(cookie_name, value)
encrypted_value = @encryptor.encrypt_and_sign(value)
@request_cookies[cookie_name] = encrypted_value
end
|
#key?(cookie_name) ⇒ Boolean
31
32
33
|
# File 'lib/dpop/cookie_jar.rb', line 31
def key?(cookie_name)
@request_cookies.key?(cookie_name)
end
|
#raw(cookie_name) ⇒ Object
18
19
20
|
# File 'lib/dpop/cookie_jar.rb', line 18
def raw(cookie_name)
@request_cookies[cookie_name]
end
|