Sha256: 0ff2208112b66812bf427950b404483047046ffb491ffaf9eadb1d9914ae461d
Contents?: true
Size: 894 Bytes
Versions: 3
Compression:
Stored size: 894 Bytes
Contents
module Crystal class Flash < OpenObject attr_accessor :previous_messages, :current_messages attr_accessor :ajax_mode, :force_keeping_mode def initialize format, previous_messages = {} self.current_messages, self.previous_messages = {}, previous_messages self.ajax_mode = format == 'js' self.force_keeping_mode = false end def [] key key = key.to_s if ajax_mode and !force_keeping_mode current_messages[key] || previous_messages[key] else previous_messages[key] end end def []= key, value current_messages[key.to_s] = value.to_s end def force_keeping_mode! self.force_keeping_mode = true end def messages_for_next_request if ajax_mode and !force_keeping_mode {} else current_messages end end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
crystal-0.0.13 | lib/crystal/html/flash.rb |
crystal-0.0.12 | lib/crystal/html/flash.rb |
crystal_ext-0.0.11 | lib/crystal/html/flash.rb |