Class: Syntropy::NowFlash
- Inherits:
-
Object
- Object
- Syntropy::NowFlash
- Defined in:
- lib/syntropy/session.rb
Overview
NowFlash holds flash data for the current request.
Instance Method Summary collapse
-
#[](key) ⇒ any
Returns the value for the given key.
-
#[]=(key, value) ⇒ any
Sets the value for the given key.
-
#each(&block) ⇒ void
Iterates through the flash storage, yielding each key-value pair to the given block.
-
#initialize ⇒ NowFlash
constructor
A new instance of NowFlash.
Constructor Details
#initialize ⇒ NowFlash
Returns a new instance of NowFlash.
100 101 102 |
# File 'lib/syntropy/session.rb', line 100 def initialize @data = {} end |
Instance Method Details
#[](key) ⇒ any
Returns the value for the given key.
108 109 110 |
# File 'lib/syntropy/session.rb', line 108 def [](key) @data[key.to_s] end |
#[]=(key, value) ⇒ any
Sets the value for the given key.
117 118 119 |
# File 'lib/syntropy/session.rb', line 117 def []=(key, value) @data[key.to_s] = value end |
#each(&block) ⇒ void
This method returns an undefined value.
Iterates through the flash storage, yielding each key-value pair to the given block.
125 126 127 |
# File 'lib/syntropy/session.rb', line 125 def each(&block) @data.each { |k, v| block.(k.to_sym, v) } end |