Ruby / Roda - Web Framework / Plugins / :cookies


Introduction

The :cookies plugin adds response methods for handling cookies.

Currently, you can set cookies with #.set_cookie and delete cookies with #.delete_cookie:

response.set_cookie('foo', 'bar')

response.delete_cookie('foo')

ResponseMethods

Modify the headers to include a Set-Cookie value that deletes the cookie.

A value hash can be provided to override the default one used to delete the cookie.

Example:

response.delete_cookie('foo')

response.delete_cookie('foo', domain: 'example.org')

Set the cookie with the given key in the headers.

response.set_cookie('foo', 'bar')

response.set_cookie('foo', value: 'bar', domain: 'example.org')