lib/roda/plugins/flash.rb in roda-1.0.0 vs lib/roda/plugins/flash.rb in roda-1.1.0
- old
+ new
@@ -24,10 +24,13 @@
# r.redirect('')
# end
# end
# end
module Flash
+ # The internal session key used to store the flash.
+ KEY = :_flash
+
# Simple flash hash, where assiging to the hash updates the flash
# used in the following request.
class FlashHash < DelegateClass(Hash)
# The flash hash for the next request. This
# is what gets written to by #[]=.
@@ -76,12 +79,9 @@
self
end
end
module InstanceMethods
- # The internal session key used to store the flash.
- KEY = :_flash
-
# Access the flash hash for the current request, loading
# it from the session if it is not already loaded.
def flash
@_flash ||= FlashHash.new(session[KEY])
end