diff options
author | Ben Orenstein <ben.orenstein@gmail.com> | 2011-06-29 15:16:57 -0400 |
---|---|---|
committer | Ben Orenstein <ben.orenstein@gmail.com> | 2011-06-29 15:16:57 -0400 |
commit | 701e8554a8f69b0c81fe794cba985bfda804161b (patch) | |
tree | 849d590fa8fac7036651c9ae62c3f1c891f0f816 /actionpack/lib/action_dispatch/middleware/flash.rb | |
parent | c49d1f2b265173fee7ed90211baa164d79f39fb1 (diff) | |
download | rails-701e8554a8f69b0c81fe794cba985bfda804161b.tar.gz rails-701e8554a8f69b0c81fe794cba985bfda804161b.tar.bz2 rails-701e8554a8f69b0c81fe794cba985bfda804161b.zip |
Delegate to @flashes with 'delegate' instead of manually.
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware/flash.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/flash.rb | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/flash.rb b/actionpack/lib/action_dispatch/middleware/flash.rb index 2adbce031b..0b501e9643 100644 --- a/actionpack/lib/action_dispatch/middleware/flash.rb +++ b/actionpack/lib/action_dispatch/middleware/flash.rb @@ -73,6 +73,8 @@ module ActionDispatch class FlashHash include Enumerable + delegate :[], :keys, :key?, :empty?, :clear, :each, :to => :@flashes + def initialize #:nodoc: @used = Set.new @closed = false @@ -94,24 +96,12 @@ module ActionDispatch @flashes[k] = v end - def [](k) - @flashes[k] - end - def update(h) #:nodoc: h.keys.each { |k| keep(k) } @flashes.update h self end - def keys - @flashes.keys - end - - def key?(name) - @flashes.key? name - end - def delete(key) @flashes.delete key self @@ -121,18 +111,6 @@ module ActionDispatch @flashes.dup end - def empty? - @flashes.empty? - end - - def clear - @flashes.clear - end - - def each(&block) - @flashes.each(&block) - end - alias :merge! :update def replace(h) #:nodoc: |