Class: Crystal::Flash
- Defined in:
- lib/crystal/html/flash.rb
Instance Attribute Summary collapse
-
#ajax_mode ⇒ Object
Returns the value of attribute ajax_mode.
-
#current_messages ⇒ Object
Returns the value of attribute current_messages.
-
#force_keeping_mode ⇒ Object
Returns the value of attribute force_keeping_mode.
-
#previous_messages ⇒ Object
Returns the value of attribute previous_messages.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #force_keeping_mode! ⇒ Object
-
#initialize(format, previous_messages = {}) ⇒ Flash
constructor
A new instance of Flash.
- #messages_for_next_request ⇒ Object
Constructor Details
#initialize(format, previous_messages = {}) ⇒ Flash
Returns a new instance of Flash.
7 8 9 10 11 |
# File 'lib/crystal/html/flash.rb', line 7 def initialize format, = {} self., self. = {}, self.ajax_mode = format == 'js' self.force_keeping_mode = false end |
Instance Attribute Details
#ajax_mode ⇒ Object
Returns the value of attribute ajax_mode.
5 6 7 |
# File 'lib/crystal/html/flash.rb', line 5 def ajax_mode @ajax_mode end |
#current_messages ⇒ Object
Returns the value of attribute current_messages.
3 4 5 |
# File 'lib/crystal/html/flash.rb', line 3 def @current_messages end |
#force_keeping_mode ⇒ Object
Returns the value of attribute force_keeping_mode.
5 6 7 |
# File 'lib/crystal/html/flash.rb', line 5 def force_keeping_mode @force_keeping_mode end |
#previous_messages ⇒ Object
Returns the value of attribute previous_messages.
3 4 5 |
# File 'lib/crystal/html/flash.rb', line 3 def @previous_messages end |
Instance Method Details
#[](key) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/crystal/html/flash.rb', line 13 def [] key key = key.to_s if ajax_mode and !force_keeping_mode [key] || [key] else [key] end end |
#[]=(key, value) ⇒ Object
23 24 25 |
# File 'lib/crystal/html/flash.rb', line 23 def []= key, value [key.to_s] = value.to_s end |
#force_keeping_mode! ⇒ Object
27 28 29 |
# File 'lib/crystal/html/flash.rb', line 27 def force_keeping_mode! self.force_keeping_mode = true end |
#messages_for_next_request ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/crystal/html/flash.rb', line 31 def if ajax_mode and !force_keeping_mode {} else end end |