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
32 33 34 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 32 def [](type) @_now[type] end |
#[]=(type, message) ⇒ Object
38 39 40 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 38 def []=(type, ) @_next[type] = end |
#clear ⇒ Object
114 115 116 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 114 def clear @_now.clear end |
#delete(type) ⇒ Object
44 45 46 47 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 44 def delete(type) @_now.delete(type) self end |
#discard(key = nil) ⇒ Object
103 104 105 106 107 108 109 110 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 103 def discard(key = nil) if key @_next.delete(key) else @_next = {} end self end |
#each(&block) ⇒ Object
63 64 65 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 63 def each(&block) @_now.each(&block) end |
#empty? ⇒ Boolean
120 121 122 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 120 def empty? @_now.empty? end |
#error ⇒ Object
149 150 151 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 149 def error self[:error] end |
#error=(message) ⇒ Object
143 144 145 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 143 def error=() self[:error] = end |
#keep(key = nil) ⇒ Object
92 93 94 95 96 97 98 99 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 92 def keep(key = nil) if key @_next[key] = @_now[key] else @_next.merge!(@_now) end self end |
#key?(type) ⇒ Boolean
57 58 59 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 57 def key?(type) @_now.key?(type) end |
#keys ⇒ Object
51 52 53 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 51 def keys @_now.keys end |
#length ⇒ Object Also known as: size
130 131 132 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 130 def length @_now.length end |
#next ⇒ Object
26 27 28 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 26 def next @_next end |
#notice ⇒ Object
161 162 163 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 161 def notice self[:notice] end |
#notice=(message) ⇒ Object
155 156 157 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 155 def notice=() self[:notice] = end |
#now ⇒ Object
22 23 24 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 22 def now @_now end |
#replace(hash) ⇒ Object
69 70 71 72 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 69 def replace(hash) @_now.replace(hash) self end |
#success ⇒ Object
173 174 175 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 173 def success self[:success] end |
#success=(message) ⇒ Object
167 168 169 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 167 def success=() self[:success] = end |
#sweep ⇒ Object
84 85 86 87 88 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 84 def sweep @_now.replace(@_next) @_next = {} self end |
#to_hash ⇒ Object
126 127 128 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 126 def to_hash @_now.dup end |
#to_s ⇒ Object
137 138 139 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 137 def to_s @_now.to_s end |
#update(hash) ⇒ Object Also known as: merge!
76 77 78 79 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 76 def update(hash) @_now.update(hash) self end |