Class: StackableFlash::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/stackable_flash/config.rb

Constant Summary collapse

DEFAULTS =
{
  # Specify how stacked flashes at the same key (e.g. :notice, :errors) should be returned:
  #
  # Example:
  #   flash[:notice] = 'Message 1'
  #   flash[:notice] << 'Message 2'
  #
  # the flash[:notice] object now looks like when :stack_with_proc => lambda { |arr| arr }:
  #
  #   flash[:notice] # => ['Message 1','Message 2']
  #
  # the flash[:notice] object now looks like when :stack_with_proc => lambda { |arr| arr.join('<br/>') }:
  #
  #   flash[:notice] # => "Message 1<br/>Message 2"
  #
  # The default leaves the flash as a string of all the flashes joined by br tags,
  #   to preserve compatibility with existing javascript, and/or views
  #   that expect the flashes as a single string.
  :stack_with_proc => Proc.new { |arr| arr.join('<br/>') }
}

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject

Returns the value of attribute config.



5
6
7
# File 'lib/stackable_flash/config.rb', line 5

def config
  @config
end

Class Method Details

.configure {|@@config| ... } ⇒ Object

Yields:



33
34
35
# File 'lib/stackable_flash/config.rb', line 33

def self.configure &block
  yield @@config
end