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.



94
95
96
97
98
99
100
101
102
# File 'lib/roda/plugins/flash.rb', line 94

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.



88
89
90
# File 'lib/roda/plugins/flash.rb', line 88

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