Module: WebPipe::Flash
- Included in:
- Conn
- Defined in:
- lib/web_pipe/extensions/flash/flash.rb
Overview
See the docs for the extension linked from the README.
Constant Summary collapse
- RACK_FLASH_KEY =
'x-rack.flash'
Instance Method Summary collapse
-
#add_flash(key, value) ⇒ Object
Adds an item to the flash bag to be consumed by next request.
-
#add_flash_now(key, value) ⇒ Object
Adds an item to the flash bag to be consumed by the same request in process.
-
#flash ⇒ Rack::Flash::FlashHash
Returns the flash bag.
Instance Method Details
#add_flash(key, value) ⇒ Object
Adds an item to the flash bag to be consumed by next request.
30 31 32 33 |
# File 'lib/web_pipe/extensions/flash/flash.rb', line 30 def add_flash(key, value) flash[key] = value self end |
#add_flash_now(key, value) ⇒ Object
Adds an item to the flash bag to be consumed by the same request in process.
40 41 42 43 |
# File 'lib/web_pipe/extensions/flash/flash.rb', line 40 def add_flash_now(key, value) flash.now[key] = value self end |
#flash ⇒ Rack::Flash::FlashHash
Returns the flash bag.
is not being used as middleware
18 19 20 21 22 23 24 |
# File 'lib/web_pipe/extensions/flash/flash.rb', line 18 def flash env.fetch(RACK_FLASH_KEY) do raise ConnSupport::MissingMiddlewareError.new( 'flash', 'Rack::Flash', 'https://rubygems.org/gems/rack-flash3' ) end end |