Module: Sinatra::Flash

Defined in:
lib/sinatra/flash.rb,
lib/sinatra/flash/hash.rb,
lib/sinatra/flash/style.rb,
lib/sinatra/flash/storage.rb

Defined Under Namespace

Modules: Storage, Style Classes: FlashHash

Class Method Summary collapse

Class Method Details

.registered(app) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/sinatra/flash.rb', line 9

def self.registered(app)
  app.helpers Flash::Storage
  app.helpers Flash::Style

  # This callback rotates any flash structure we referenced, placing the 'next' hash into the session
  # for the next request.
  app.after {@flash.each{|key, flash| session[key] = @flash[key].next} if @flash}
end