diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2015-09-06 17:42:57 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2015-09-08 20:27:04 +0200 |
commit | 379ddf54c00723c816b0dd4aa78d0cd47f159772 (patch) | |
tree | 0caf68ac4b8036557f298c847f9288e4861e4883 /actionpack/lib/action_dispatch | |
parent | 143d047d659799acad1563c4ca902c0b7c062f6b (diff) | |
download | rails-379ddf54c00723c816b0dd4aa78d0cd47f159772.tar.gz rails-379ddf54c00723c816b0dd4aa78d0cd47f159772.tar.bz2 rails-379ddf54c00723c816b0dd4aa78d0cd47f159772.zip |
Add commit method to share option normalization
Remove the clutter to make PermanentCookieJar's one change stand out.
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/cookies.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb index d3e1887478..4a9b534212 100644 --- a/actionpack/lib/action_dispatch/middleware/cookies.rb +++ b/actionpack/lib/action_dispatch/middleware/cookies.rb @@ -422,19 +422,27 @@ module ActionDispatch def [](name) @parent_jar[name.to_s] end - end - class PermanentCookieJar < AbstractCookieJar # :nodoc: def []=(name, options) if options.is_a?(Hash) options.symbolize_keys! else - options = { :value => options } + options = { value: options } end - options[:expires] = 20.years.from_now + commit(options) @parent_jar[name] = options end + + private + def commit(options); end + end + + class PermanentCookieJar < AbstractCookieJar # :nodoc: + private + def commit(options) + options[:expires] = 20.years.from_now + end end class JsonSerializer # :nodoc: |