Class: Radical::Flash

Inherits:
Object
  • Object
show all
Defined in:
lib/radical/flash.rb

Defined Under Namespace

Classes: FlashHash, SessionUnavailable

Constant Summary collapse

SESSION_KEY =
'rack.session'
FLASH_KEY =
'__FLASH__'

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Flash

Returns a new instance of Flash.



45
46
47
# File 'lib/radical/flash.rb', line 45

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/radical/flash.rb', line 49

def call(env)
  flash_hash ||= FlashHash.new(env[SESSION_KEY])

  flash_hash.mark!

  res = @app.call(env)

  flash_hash.clear!

  res
end