Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Delegate to @flashes with 'delegate' instead of manually.

  • Loading branch information...
commit 701e8554a8f69b0c81fe794cba985bfda804161b 1 parent c49d1f2
Ben Orenstein authored

Showing 1 changed file with 2 additions and 24 deletions. Show diff stats Hide diff stats

  1. +2 24 actionpack/lib/action_dispatch/middleware/flash.rb
26 actionpack/lib/action_dispatch/middleware/flash.rb
@@ -73,6 +73,8 @@ def notice=(message)
73 73 class FlashHash
74 74 include Enumerable
75 75
  76 + delegate :[], :keys, :key?, :empty?, :clear, :each, :to => :@flashes
  77 +
76 78 def initialize #:nodoc:
77 79 @used = Set.new
78 80 @closed = false
@@ -94,24 +96,12 @@ def []=(k, v) #:nodoc:
94 96 @flashes[k] = v
95 97 end
96 98
97   - def [](k)
98   - @flashes[k]
99   - end
100   -
101 99 def update(h) #:nodoc:
102 100 h.keys.each { |k| keep(k) }
103 101 @flashes.update h
104 102 self
105 103 end
106 104
107   - def keys
108   - @flashes.keys
109   - end
110   -
111   - def key?(name)
112   - @flashes.key? name
113   - end
114   -
115 105 def delete(key)
116 106 @flashes.delete key
117 107 self
@@ -121,18 +111,6 @@ def to_hash
121 111 @flashes.dup
122 112 end
123 113
124   - def empty?
125   - @flashes.empty?
126   - end
127   -
128   - def clear
129   - @flashes.clear
130   - end
131   -
132   - def each(&block)
133   - @flashes.each(&block)
134   - end
135   -
136 114 alias :merge! :update
137 115
138 116 def replace(h) #:nodoc:

0 comments on commit 701e855

Please sign in to comment.
Something went wrong with that request. Please try again.