Class: Rack::Flash
- Inherits:
-
Object
- Object
- Rack::Flash
- Defined in:
- lib/rack/flash.rb,
lib/rack/flash/test.rb
Defined Under Namespace
Classes: FlashHash, SessionUnavailable
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(app, opts = {}) ⇒ Flash
constructor
————————————————————————- - Rack Middleware implementation.
- #new_call(env) ⇒ Object (also: #call)
Constructor Details
#initialize(app, opts = {}) ⇒ Flash
-
Rack Middleware implementation
137 138 139 140 141 142 143 144 145 |
# File 'lib/rack/flash.rb', line 137 def initialize(app, opts={}) if klass = app_class(app, opts) klass.class_eval do def flash; env['x-rack.flash'] end end end @app, @opts = app, opts end |
Class Method Details
.fake_session ⇒ Object
3 4 5 |
# File 'lib/rack/flash/test.rb', line 3 def self.fake_session @fake_session ||= {} end |
Instance Method Details
#new_call(env) ⇒ Object Also known as: call
8 9 10 11 |
# File 'lib/rack/flash/test.rb', line 8 def new_call(env) env['rack.session'] ||= Rack::Flash.fake_session old_call(env) end |