Class: Padrino::Flash::Storage
- Inherits:
-
Object
- Object
- Padrino::Flash::Storage
- Includes:
- Enumerable
- Defined in:
- lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb
Overview
self
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
-
#initialize(session = nil) ⇒ Storage
constructor
A new instance of Storage.
- #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!)
Constructor Details
#initialize(session = nil) ⇒ Storage
Returns a new instance of Storage.
18 19 20 21 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 18 def initialize(session=nil) @_now = session || {} @_next = {} end |
Instance Method Details
#[](type) ⇒ Object
33 34 35 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 33 def [](type) @_now[type] end |
#[]=(type, message) ⇒ Object
39 40 41 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 39 def []=(type, ) @_next[type] = end |
#clear ⇒ Object
115 116 117 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 115 def clear @_now.clear end |
#delete(type) ⇒ Object
45 46 47 48 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 45 def delete(type) @_now.delete(type) self end |
#discard(key = nil) ⇒ Object
104 105 106 107 108 109 110 111 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 104 def discard(key = nil) if key @_next.delete(key) else @_next = {} end self end |
#each(&block) ⇒ Object
64 65 66 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 64 def each(&block) @_now.each(&block) end |
#empty? ⇒ Boolean
121 122 123 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 121 def empty? @_now.empty? end |
#error ⇒ Object
150 151 152 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 150 def error self[:error] end |
#error=(message) ⇒ Object
144 145 146 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 144 def error=() self[:error] = end |
#keep(key = nil) ⇒ Object
93 94 95 96 97 98 99 100 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 93 def keep(key = nil) if key @_next[key] = @_now[key] else @_next.merge!(@_now) end self end |
#key?(type) ⇒ Boolean
58 59 60 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 58 def key?(type) @_now.key?(type) end |
#keys ⇒ Object
52 53 54 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 52 def keys @_now.keys end |
#length ⇒ Object Also known as: size
131 132 133 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 131 def length @_now.length end |
#next ⇒ Object
27 28 29 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 27 def next @_next end |
#notice ⇒ Object
162 163 164 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 162 def notice self[:notice] end |
#notice=(message) ⇒ Object
156 157 158 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 156 def notice=() self[:notice] = end |
#now ⇒ Object
23 24 25 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 23 def now @_now end |
#replace(hash) ⇒ Object
70 71 72 73 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 70 def replace(hash) @_now.replace(hash) self end |
#success ⇒ Object
174 175 176 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 174 def success self[:success] end |
#success=(message) ⇒ Object
168 169 170 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 168 def success=() self[:success] = end |
#sweep ⇒ Object
85 86 87 88 89 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 85 def sweep @_now.replace(@_next) @_next = {} self end |
#to_hash ⇒ Object
127 128 129 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 127 def to_hash @_now.dup end |
#to_s ⇒ Object
138 139 140 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 138 def to_s @_now.to_s end |
#update(hash) ⇒ Object Also known as: merge!
77 78 79 80 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb', line 77 def update(hash) @_now.update(hash) self end |