class Raamen::Flash

Attributes

flash[R]
now[R]

Public Class Methods

new(req) click to toggle source
# File lib/raamen/flash.rb, line 5
def initialize(req)
  flash = req.cookies["_rails_lite_app_flash"]
  @now = flash ? Now.new(JSON.parse(flash)) : Now.new({})
  @flash = {}
end

Public Instance Methods

[](key) click to toggle source
# File lib/raamen/flash.rb, line 11
def [](key)
  self.now[key.to_sym] || self.flash[key.to_sym]
end
[]=(key, val) click to toggle source
# File lib/raamen/flash.rb, line 15
def []=(key, val)
  self.flash[key.to_sym] = val
end
store_flash(res) click to toggle source
# File lib/raamen/flash.rb, line 19
def store_flash(res)
  res.set_cookie("_rails_lite_app_flash", {path: "/", value: self.flash.to_json})
end