Class: Rad::Html::Flash
Instance Attribute Summary collapse
-
#current_messages ⇒ Object
Returns the value of attribute current_messages.
-
#previous_messages ⇒ Object
Returns the value of attribute previous_messages.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize(format, previous_messages = {}) ⇒ Flash
constructor
A new instance of Flash.
- #keep! ⇒ Object
- #keep? ⇒ Boolean
- #messages_for_next_request ⇒ Object
Constructor Details
#initialize(format, previous_messages = {}) ⇒ Flash
Returns a new instance of Flash.
4 5 6 7 |
# File 'lib/rad/html/_flash.rb', line 4 def initialize format, = {} self., self. = {}, @keep = false end |
Instance Attribute Details
#current_messages ⇒ Object
Returns the value of attribute current_messages.
2 3 4 |
# File 'lib/rad/html/_flash.rb', line 2 def @current_messages end |
#previous_messages ⇒ Object
Returns the value of attribute previous_messages.
2 3 4 |
# File 'lib/rad/html/_flash.rb', line 2 def @previous_messages end |
Instance Method Details
#[](key) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/rad/html/_flash.rb', line 9 def [] key key = key.to_s if keep? [key] else [key] || [key] end end |
#[]=(key, value) ⇒ Object
19 20 21 |
# File 'lib/rad/html/_flash.rb', line 19 def []= key, value [key.to_s] = value.to_s end |
#keep! ⇒ Object
23 24 25 26 |
# File 'lib/rad/html/_flash.rb', line 23 def keep! @keep = true self end |
#keep? ⇒ Boolean
28 29 30 |
# File 'lib/rad/html/_flash.rb', line 28 def keep? !!@keep end |
#messages_for_next_request ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/rad/html/_flash.rb', line 32 def if keep? else {} end end |