Class: Flash
- Inherits:
-
Object
- Object
- Flash
- Defined in:
- lib/flash.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, val) ⇒ Object
-
#initialize(req) ⇒ Flash
constructor
A new instance of Flash.
- #now ⇒ Object
- #store_flash(res) ⇒ Object
Constructor Details
permalink #initialize(req) ⇒ Flash
Returns a new instance of Flash.
4 5 6 7 8 9 10 11 |
# File 'lib/flash.rb', line 4 def initialize(req) if req.['_bezel_flash'] @flash = JSON.parse(req.['_bezel_flash']) else @flash = {} end @flash_now = {} end |
Instance Method Details
permalink #[](key) ⇒ Object
[View source]
17 18 19 20 |
# File 'lib/flash.rb', line 17 def [](key) return @flash_now[key] if @flash_now[key] @flash[key.to_s] end |
permalink #[]=(key, val) ⇒ Object
[View source]
13 14 15 |
# File 'lib/flash.rb', line 13 def []=(key,val) @flash[key] = val end |
permalink #now ⇒ Object
[View source]
26 27 28 |
# File 'lib/flash.rb', line 26 def now @flash_now end |
permalink #store_flash(res) ⇒ Object
[View source]
22 23 24 |
# File 'lib/flash.rb', line 22 def store_flash(res) res.('_bezel_flash', value: @flash.to_json, path: '/') end |