Class: Padrino::Flash::Storage
- Includes:
- Enumerable
- Defined in:
- padrino-core/lib/padrino-core/application/flash.rb
Instance Method Summary collapse
- #[](type) ⇒ Object
- #[]=(type, message) ⇒ Object
- #clear ⇒ Object
- #delete(type) ⇒ Object
- #discard(key = nil) ⇒ Object
- #each(&block) ⇒ Object
- #empty? ⇒ Boolean
- #error ⇒ Object
- #error=(message) ⇒ Object
- #keep(key = nil) ⇒ Object
- #key?(type) ⇒ Boolean
- #keys ⇒ Object
- #length ⇒ Object (also: #size)
- #next ⇒ Object
- #notice ⇒ Object
- #notice=(message) ⇒ Object
- #now ⇒ Object
- #replace(hash) ⇒ Object
- #success ⇒ Object
- #success=(message) ⇒ Object
- #sweep ⇒ Object
- #to_hash ⇒ Object
- #to_s ⇒ Object
- #update(hash) ⇒ Object (also: #merge!)
Instance Method Details
#[](type) ⇒ Object
31 32 33 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 31 def [](type) @_now[type] end |
#[]=(type, message) ⇒ Object
37 38 39 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 37 def []=(type, ) @_next[type] = end |
#clear ⇒ Object
113 114 115 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 113 def clear @_now.clear end |
#delete(type) ⇒ Object
43 44 45 46 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 43 def delete(type) @_now.delete(type) self end |
#discard(key = nil) ⇒ Object
102 103 104 105 106 107 108 109 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 102 def discard(key = nil) if key @_next.delete(key) else @_next = {} end self end |
#each(&block) ⇒ Object
62 63 64 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 62 def each(&block) @_now.each(&block) end |
#empty? ⇒ Boolean
119 120 121 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 119 def empty? @_now.empty? end |
#error ⇒ Object
148 149 150 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 148 def error self[:error] end |
#error=(message) ⇒ Object
142 143 144 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 142 def error=() self[:error] = end |
#keep(key = nil) ⇒ Object
91 92 93 94 95 96 97 98 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 91 def keep(key = nil) if key @_next[key] = @_now[key] else @_next.merge!(@_now) end self end |
#key?(type) ⇒ Boolean
56 57 58 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 56 def key?(type) @_now.key?(type) end |
#keys ⇒ Object
50 51 52 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 50 def keys @_now.keys end |
#length ⇒ Object Also known as: size
129 130 131 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 129 def length @_now.length end |
#next ⇒ Object
25 26 27 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 25 def next @_next end |
#notice ⇒ Object
160 161 162 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 160 def notice self[:notice] end |
#notice=(message) ⇒ Object
154 155 156 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 154 def notice=() self[:notice] = end |
#now ⇒ Object
21 22 23 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 21 def now @_now end |
#replace(hash) ⇒ Object
68 69 70 71 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 68 def replace(hash) @_now.replace(hash) self end |
#success ⇒ Object
172 173 174 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 172 def success self[:success] end |
#success=(message) ⇒ Object
166 167 168 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 166 def success=() self[:success] = end |
#sweep ⇒ Object
83 84 85 86 87 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 83 def sweep @_now.replace(@_next) @_next = {} self end |
#to_hash ⇒ Object
125 126 127 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 125 def to_hash @_now.dup end |
#to_s ⇒ Object
136 137 138 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 136 def to_s @_now.to_s end |
#update(hash) ⇒ Object Also known as: merge!
75 76 77 78 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 75 def update(hash) @_now.update(hash) self end |