Sha256: eb69ccb86ce1f92480db26305c252073752a7d6a5ad6fab6b6c8022e68063aee

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

class RailsExceptionHandler::Configuration
  attr_accessor :storage_strategies, :environments, :filters, :responses, :response_mapping, :fallback_layout, :store_user_info, :env_info_block, :global_info_block, :exception_info_block, :request_info_block

  def initialize
    @environments = [:production]
    @storage_strategies = []
    @filters = []
    @store_user_info = false
    @fallback_layout = 'application'
    @response_mapping = {}
    @responses = {}
    @whitelisted = false
  end

  def active_record?
    @storage_strategies.include?(:active_record)
  end

  def activate?
    environments.include?(Rails.env.to_sym)
  end

  def after_initialize(&block)
    @callback = block
  end

  def run_callback
    @callback.call if(@callback)
  end

  def store_environment_info(&block)
    @env_info_block = block
  end

  def store_global_info(&block)
    @global_info_block = block
  end

  def store_exception_info(&block)
    @exception_info_block = block
  end

  def store_request_info(&block)
    @request_info_block = block
  end

  def whitelist(fields)
    return if(whitelisted?)
    ErrorMessage.send(:attr_accessible, *fields)
    @whitelisted = true
  end

  private

  def whitelisted?
    @whitelisted
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_exception_handler-2.1.0 lib/rails_exception_handler/configuration.rb
rails_exception_handler-2.0.2 lib/rails_exception_handler/configuration.rb