diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2011-04-07 09:26:04 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-04-07 09:26:04 -0300 |
commit | 03d561ad77085f17ba816ebec619a3d359b2164e (patch) | |
tree | 1381f0cbdd198678cd3175d1089c5b0a6b901875 /actionpack | |
parent | 5b0149a17aa423d0adbec10c8fb8449f15d16673 (diff) | |
download | rails-03d561ad77085f17ba816ebec619a3d359b2164e.tar.gz rails-03d561ad77085f17ba816ebec619a3d359b2164e.tar.bz2 rails-03d561ad77085f17ba816ebec619a3d359b2164e.zip |
Revert "Use freeze instead of close!"
This reverts commit 29592a7f09dda2e7e1e0a915d9230fe6a9b5c0af.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/cookies.rb | 7 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/flash.rb | 12 | ||||
-rw-r--r-- | actionpack/test/dispatch/cookies_test.rb | 6 |
3 files changed, 14 insertions, 11 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb index 3ed5f1055f..24ebb8fed7 100644 --- a/actionpack/lib/action_dispatch/middleware/cookies.rb +++ b/actionpack/lib/action_dispatch/middleware/cookies.rb @@ -115,10 +115,13 @@ module ActionDispatch @delete_cookies = {} @host = host @secure = secure + @closed = false @cookies = {} end - alias :closed? :frozen? + attr_reader :closed + alias :closed? :closed + def close!; @closed = true end # Returns the value of the cookie by +name+, or +nil+ if no such cookie exists. def [](name) @@ -327,7 +330,7 @@ module ActionDispatch [status, headers, body] ensure cookie_jar = ActionDispatch::Request.new(env).cookie_jar unless cookie_jar - cookie_jar.freeze + cookie_jar.close! end end end diff --git a/actionpack/lib/action_dispatch/middleware/flash.rb b/actionpack/lib/action_dispatch/middleware/flash.rb index e7090ecf1b..6eda1f31a7 100644 --- a/actionpack/lib/action_dispatch/middleware/flash.rb +++ b/actionpack/lib/action_dispatch/middleware/flash.rb @@ -43,9 +43,12 @@ module ActionDispatch class FlashNow #:nodoc: def initialize(flash) @flash = flash + @closed = false end - alias :closed? :frozen? + attr_reader :closed + alias :closed? :closed + def close!; @closed = true end def []=(k, v) raise ClosedError, :flash if closed? @@ -73,9 +76,12 @@ module ActionDispatch def initialize #:nodoc: super @used = Set.new + @closed = false end - alias :closed? :frozen? + attr_reader :closed + alias :closed? :closed + def close!; @closed = true end def []=(k, v) #:nodoc: raise ClosedError, :flash if closed? @@ -194,7 +200,7 @@ module ActionDispatch if !flash_hash.empty? || session.key?('flash') session["flash"] = flash_hash end - flash_hash.freeze + flash_hash.close! end if session.key?('flash') && session['flash'].empty? diff --git a/actionpack/test/dispatch/cookies_test.rb b/actionpack/test/dispatch/cookies_test.rb index cd07230a57..ebc16694db 100644 --- a/actionpack/test/dispatch/cookies_test.rb +++ b/actionpack/test/dispatch/cookies_test.rb @@ -502,16 +502,10 @@ class CookiesIntegrationTest < ActionDispatch::IntegrationTest class TestController < ActionController::Base def dont_set_cookies - # initialize lazy loaded objects - cookies.permanent - cookies.signed head :ok end def set_cookies - # initialize lazy loaded objects - cookies.permanent - cookies.signed cookies["that"] = "hello" head :ok end |