class TurboFlash::FlashTurbo
Attributes
options[R]
Public Class Methods
new(flash)
click to toggle source
Calls superclass method
# File lib/turbo_flash/flash_turbo.rb, line 8 def initialize(flash) super @copied_flashes = false @temp_options = nil @default_render_target = TurboFlash.configuration.target @default_render_options = { action: TurboFlash.configuration.action, partial: TurboFlash.configuration.partial } @locals_key = TurboFlash.configuration.key @locals_value = TurboFlash.configuration.value @options = {} @clear_target = false @cleared = false end
Public Instance Methods
[]=(k, v)
click to toggle source
Calls superclass method
# File lib/turbo_flash/flash_turbo.rb, line 68 def []=(k, v) super @options_for_flash = {} @options_for_flash = @default_render_options.dup @options_for_flash.merge!({ target: @default_render_target }) @options_for_flash[:locals] = { @locals_key => k, @locals_value => v } if @temp_options @options_for_flash.merge!(@temp_options) @temp_options = nil end @options[k.to_s] = @options_for_flash v end
clear!()
click to toggle source
# File lib/turbo_flash/flash_turbo.rb, line 42 def clear! @cleared = true end
clear_target!()
click to toggle source
# File lib/turbo_flash/flash_turbo.rb, line 56 def clear_target! @clear_target = true end
clear_target?()
click to toggle source
# File lib/turbo_flash/flash_turbo.rb, line 52 def clear_target? @clear_target end
cleared?()
click to toggle source
# File lib/turbo_flash/flash_turbo.rb, line 34 def cleared? @cleared end
copied_flashes?()
click to toggle source
# File lib/turbo_flash/flash_turbo.rb, line 21 def copied_flashes? @copied_flashes end
flashes()
click to toggle source
# File lib/turbo_flash/flash_turbo.rb, line 64 def flashes @flash.instance_variable_get(:@flashes) end
from_flash(k, v, options = {})
click to toggle source
# File lib/turbo_flash/flash_turbo.rb, line 46 def from_flash(k, v, options = {}) set_options(options)[k] = v true end
from_flashes(other_flashes, options)
click to toggle source
# File lib/turbo_flash/flash_turbo.rb, line 25 def from_flashes(other_flashes, options) other_flashes.each do |k,v| from_flash(k, v, options) end @copied_flashes = true true end
reset_clear_target!()
click to toggle source
# File lib/turbo_flash/flash_turbo.rb, line 60 def reset_clear_target! @clear_target = false end
set_options(options = {})
click to toggle source
# File lib/turbo_flash/flash_turbo.rb, line 86 def set_options(options = {}) @temp_options = options self end
unclear!()
click to toggle source
# File lib/turbo_flash/flash_turbo.rb, line 38 def unclear! @cleared = false end