The purpose of this class is to act as a unifier of the previous and current flash.
Flash means pairs of keys and values that are held only over one request/response cycle. So you can assign a key/value in the current session and retrieve it in the current and following request.
Please see the Innate::Helper::Flash for details on the usage in your application.
flash in your Controller
# File lib/innate/session/flash.rb, line 42 def [](key) combined[key] end
flash = value in your Controller
# File lib/innate/session/flash.rb, line 47 def []=(key, value) prev = session[:FLASH] || {} prev[key] = value session[:FLASH] = prev end
combined key/value pairs of previous and current current keys overshadow the old ones.
# File lib/innate/session/flash.rb, line 37 def combined previous.merge(current) end
the current session
# File lib/innate/session/flash.rb, line 31 def current session[:FLASH] ||= {} end
Delete a key
# File lib/innate/session/flash.rb, line 59 def delete(key) previous.delete(key) current.delete(key) end
iterate over the combined session
# File lib/innate/session/flash.rb, line 21 def each(&block) combined.each(&block) end
check if combined is empty
# File lib/innate/session/flash.rb, line 65 def empty? combined.empty? end
Inspects combined
# File lib/innate/session/flash.rb, line 54 def inspect combined.inspect end
merge on current
# File lib/innate/session/flash.rb, line 75 def merge(hash) current.merge(hash) end
merge into current
# File lib/innate/session/flash.rb, line 70 def merge!(hash) current.merge!(hash) end
the current session
# File lib/innate/session/flash.rb, line 26 def previous session[:FLASH_PREVIOUS] || {} end
Generated with the Darkfish Rdoc Generator 2.