class Radical::Flash::FlashHash
Public Class Methods
new(session)
click to toggle source
# File lib/radical/flash.rb, line 11 def initialize(session) raise SessionUnavailable, 'No session variable found. Requires Rack::Session' unless session @session = session end
Public Instance Methods
[](key)
click to toggle source
# File lib/radical/flash.rb, line 17 def [](key) hash[key] ||= session.delete(key) end
[]=(key, value)
click to toggle source
# File lib/radical/flash.rb, line 21 def []=(key, value) hash[key] = session[key] = value end
clear!()
click to toggle source
# File lib/radical/flash.rb, line 29 def clear! @flagged.each { |k| session.delete(k) } @flagged.clear end
mark!()
click to toggle source
# File lib/radical/flash.rb, line 25 def mark! @flagged = session.keys end
Private Instance Methods
hash()
click to toggle source
# File lib/radical/flash.rb, line 36 def hash @hash ||= {} end
session()
click to toggle source
# File lib/radical/flash.rb, line 40 def session @session[FLASH_KEY] ||= {} end