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')
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'
Classes and Modules
Public Class methods
configure(app, opts={})
Allow setting default cookie options when loading the cookies plugin.
[show source]
# File lib/roda/plugins/cookies.rb 22 def self.configure(app, opts={}) 23 app.opts[:cookies_opts] = (app.opts[:cookies_opts]||{}).merge(opts).freeze 24 end