sinatra/sinatra-contrib — pull request #66 by kylewlacy (2012-09-23 04:21:26+00:00)
Title: Modify cookie[]= method to support additional options

From what I understand, when using Sinatra::Cookie, if a cookie needed to have extra options (such as `:expire`, for example), then the global cookie options needed to change. I've modified the `[]=` method in the `Jar` class to support such extra options. For example, the following syntax would set an expiration on the '`:foo`' cookie:

cookie[:foo, :expires => 30*24*60*60] = 'bar'
# The 'foo' cookie will now expire in 30 days

The usefulness of this seems obvious, and I'm surprised that this hasn't been done before. I've also written an accompanying spec for this behavior, while all previous specs passed without modification.