Class: Cuca::SessionFlash
- Inherits:
-
Object
- Object
- Cuca::SessionFlash
show all
- Defined in:
- lib/cuca/sessionflash.rb
Overview
Whatever you write into flash will be valid for the current and for the next http request. You can keep the content for another cycle by calling the keep method. Access via session.flash. (See Cuca::Session)
Defined Under Namespace
Classes: SessionFlashItem
Instance Method Summary
collapse
Constructor Details
32
33
34
35
36
|
# File 'lib/cuca/sessionflash.rb', line 32
def initialize(session)
@ses = session
@ses[:SessionFlash] ||= {}
expire
end
|
Instance Method Details
#[](key) ⇒ Object
38
39
40
|
# File 'lib/cuca/sessionflash.rb', line 38
def [](key)
flashmem[key] ? flashmem[key].value : nil
end
|
#[]=(key, value) ⇒ Object
42
43
44
|
# File 'lib/cuca/sessionflash.rb', line 42
def []=(key, value)
flashmem[key] = SessionFlashItem.new(value)
end
|
#keep ⇒ Object
46
47
48
|
# File 'lib/cuca/sessionflash.rb', line 46
def keep
flashmem.each_pair { |k,v| v.keep }
end
|