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.



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

def call
  res = super

  if f = @_flash
    session[KEY] = 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.



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

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