提交 dea16026 编写于 作者: A Aaron Patterson

rename @used to something a bit more meaningful

上级 ffad4927
......@@ -78,7 +78,7 @@ class FlashHash
include Enumerable
def initialize #:nodoc:
@used = Set.new
@discard = Set.new
@closed = false
@flashes = {}
@now = nil
......@@ -139,7 +139,7 @@ def each(&block)
alias :merge! :update
def replace(h) #:nodoc:
@used = Set.new
@discard = Set.new
@flashes.replace h
self
end
......@@ -163,7 +163,7 @@ def now
# flash.keep # keeps the entire flash
# flash.keep(:notice) # keeps only the "notice" entry, the rest of the flash is discarded
def keep(k = nil)
@used.subtract Array(k || keys)
@discard.subtract Array(k || keys)
k ? self[k] : self
end
......@@ -172,7 +172,7 @@ def keep(k = nil)
# flash.discard # discard the entire flash at the end of the current action
# flash.discard(:warning) # discard only the "warning" entry at the end of the current action
def discard(k = nil)
@used.merge Array(k || keys)
@discard.merge Array(k || keys)
k ? self[k] : self
end
......@@ -181,11 +181,11 @@ def discard(k = nil)
# This method is called automatically by filters, so you generally don't need to care about it.
def sweep #:nodoc:
keys.each do |k|
unless @used.include?(k)
@used << k
unless @discard.include?(k)
@discard << k
else
delete(k)
@used.delete(k)
@discard.delete(k)
end
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册