Sha256: 487a6ce096f94a472d85ea82e8fb7099f246418d789437c62605fcc56a1252b6

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

module StackableFlash
  class Config

    class << self
      attr_accessor :config
    end

    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/>') }
    }

    #cattr_reader :config
    #cattr_writer :config

    self.config ||= DEFAULTS
    def self.configure &block
      yield @@config
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
stackable_flash-0.0.6 lib/stackable_flash/config.rb
stackable_flash-0.0.5 lib/stackable_flash/config.rb
stackable_flash-0.0.4 lib/stackable_flash/config.rb
stackable_flash-0.0.3 lib/stackable_flash/config.rb
stackable_flash-0.0.2 lib/stackable_flash/config.rb
stackable_flash-0.0.1 lib/stackable_flash/config.rb