Module: Roda::RodaPlugins::Flash::InstanceMethods

Defined in:
lib/roda/plugins/flash.rb

Instance Method Summary collapse

Instance Method Details

#callObject

If the routing doesn’t raise an error, rotate the flash hash in the session so the next request has access to it.



103
104
105
106
107
108
109
110
111
# File 'lib/roda/plugins/flash.rb', line 103

def call
  res = super

  if f = @_flash
    session[:_flash] = f.next
  end

  res
end

#flashObject

Access the flash hash for the current request, loading it from the session if it is not already loaded.



97
98
99
# File 'lib/roda/plugins/flash.rb', line 97

def flash
  @_flash ||= FlashHash.new(session[:_flash])
end