Module: Roda::RodaPlugins::Cookies
- Defined in:
- lib/roda/plugins/cookies.rb
Overview
The cookies plugin adds response methods for handling cookies. Currently, you can set cookies with set_cookie
and delete cookies with delete_cookie
:
response.('foo', 'bar')
response.('foo')
Pass a hash of cookie options when loading the plugin to set some defaults for all cookies upon setting and deleting. This is particularly useful for configuring the domain
and path
of all cookies.
plugin :cookies, domain: 'example.com', path: '/api'
Defined Under Namespace
Modules: ResponseMethods
Class Method Summary collapse
-
.configure(app, opts = {}) ⇒ Object
Allow setting default cookie options when loading the cookies plugin.
Class Method Details
.configure(app, opts = {}) ⇒ Object
Allow setting default cookie options when loading the cookies plugin.
22 23 24 |
# File 'lib/roda/plugins/cookies.rb', line 22 def self.configure(app, opts={}) app.opts[:cookies_opts] = (app.opts[:cookies_opts]||{}).merge(opts).freeze end |