Used to set up and modify settings for the notifier.
A list of filters for cleaning and pruning the backtrace. See filter_backtrace.
true if you want to check for production errors matching development errors, false otherwise.
The name of the notifier library being used to send notifications (such as “Hoptoad Notifier”)
The version of the notifier library being used to send notifications (such as “1.0.2”)
A list of parameters that should be filtered out of what is sent to Hoptoad. By default, all “password” attributes will have their contents replaced.
# File lib/hoptoad_notifier/configuration.rb, line 115 def initialize @secure = false @host = 'hoptoadapp.com' @http_open_timeout = 2 @http_read_timeout = 5 @params_filters = DEFAULT_PARAMS_FILTERS.dup @backtrace_filters = DEFAULT_BACKTRACE_FILTERS.dup @ignore_by_filters = [] @ignore = IGNORE_DEFAULT.dup @ignore_user_agent = [] @development_environments = %(development test cucumber) @development_lookup = true @notifier_name = 'Hoptoad Notifier' @notifier_version = VERSION @notifier_url = 'http://hoptoadapp.com' @framework = 'Standalone' end
Allows config options to be read like a hash
@param [Symbol] option Key for a given attribute
# File lib/hoptoad_notifier/configuration.rb, line 179 def [](option) send(option) end
# File lib/hoptoad_notifier/configuration.rb, line 215 def environment_filters warn 'config.environment_filters has been deprecated and has no effect.' [] end
Takes a block and adds it to the list of backtrace filters. When the filters run, the block will be handed each line of the backtrace and can modify it as necessary.
@example
config.filter_bracktrace do |line| line.gsub(/^#{Rails.root}/, "[RAILS_ROOT]") end
@param [Proc] block The new backtrace filter. @yieldparam [String] line A line in the backtrace.
# File lib/hoptoad_notifier/configuration.rb, line 144 def filter_backtrace(&block) self.backtrace_filters << block end
Takes a block and adds it to the list of ignore filters. When the filters run, the block will be handed the exception. @example
config.ignore_by_filter do |exception_data| true if exception_data[:error_class] == "RuntimeError" end
@param [Proc] block The new ignore filter @yieldparam [Hash] data The exception data given to HoptoadNotifier.notify @yieldreturn [Boolean] If the block returns true the exception will be ignored, otherwise it will be processed by hoptoad.
# File lib/hoptoad_notifier/configuration.rb, line 158 def ignore_by_filter(&block) self.ignore_by_filters << block end
Overrides the list of default ignored errors.
@param [Array<Exception>] names A list of exceptions to ignore.
# File lib/hoptoad_notifier/configuration.rb, line 165 def ignore_only=(names) @ignore = [names].flatten end
Overrides the list of default ignored user agents
@param [Array<String>] A list of user agents to ignore
# File lib/hoptoad_notifier/configuration.rb, line 172 def ignore_user_agent_only=(names) @ignore_user_agent = [names].flatten end
Returns a hash of all configurable options merged with hash
@param [Hash] hash A set of configuration options that will take precedence over the defaults
# File lib/hoptoad_notifier/configuration.rb, line 193 def merge(hash) to_hash.merge(hash) end
# File lib/hoptoad_notifier/configuration.rb, line 207 def protocol if secure? 'https' else 'http' end end
Generated with the Darkfish Rdoc Generator 2.