module Cookies
Helpers for working with cookies.
Definitions
def cookies
Get all cookies.
Implementation
def cookies
session.get("cookie")
end
def cookie(name)
Get a cookie by name.
Signature
-
parameter
name
String
The name of the cookie.
Implementation
def cookie(name)
session.get("cookie/#{name}")
end
def add_cookie(name, value, **options)
Add a cookie.
Signature
-
parameter
name
String
The name of the cookie.
-
parameter
value
String
The value of the cookie.
-
parameter
options
Hash
Additional options.
Implementation
def add_cookie(name, value, **options)
session.post("cookie", {name: name, value: value}.merge(options))
end
def delete_cookie(name)
Delete a cookie by name.
Signature
-
parameter
name
String
The name of the cookie.
Implementation
def delete_cookie(name)
session.delete("cookie/#{name}")
end
def delete_all_cookies
Delete all cookies.
Implementation
def delete_all_cookies
session.delete("cookie")
end