Class: Togo::FlashHash
- Inherits:
-
Object
- Object
- Togo::FlashHash
- Defined in:
- lib/togo/dispatch/dispatch.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, val) ⇒ Object
-
#initialize ⇒ FlashHash
constructor
A new instance of FlashHash.
- #sweep! ⇒ Object
Constructor Details
#initialize ⇒ FlashHash
Returns a new instance of FlashHash.
7 8 9 10 |
# File 'lib/togo/dispatch/dispatch.rb', line 7 def initialize @h = {} @c = {} end |
Instance Method Details
#[](key) ⇒ Object
11 12 13 14 |
# File 'lib/togo/dispatch/dispatch.rb', line 11 def [](key) return @c[key] if @c.keys.include?(key) @c[key] = @h.delete(key) if @h.keys.include?(key) end |
#[]=(key, val) ⇒ Object
15 16 17 |
# File 'lib/togo/dispatch/dispatch.rb', line 15 def []=(key,val) @h[key] = val end |
#sweep! ⇒ Object
18 19 20 |
# File 'lib/togo/dispatch/dispatch.rb', line 18 def sweep! @c = {} end |