# File lib/exception_notifier.rb, line 72 def clear_ignore_conditions! @@ignores.clear end
Adds a condition to decide when an exception must be ignored or not.
ExceptionNotifier.ignore_if do |exception, options| not Rails.env.production? end
# File lib/exception_notifier.rb, line 68 def ignore_if(&block) @@ignores << block end
# File lib/exception_notifier.rb, line 59 def notifiers @@notifiers.keys end
# File lib/exception_notifier.rb, line 30 def notify_exception(exception, options={}) return false if ignored_exception?(options[:ignore_exceptions], exception) return false if ignored?(exception, options) selected_notifiers = options.delete(:notifiers) || notifiers [*selected_notifiers].each do |notifier| fire_notification(notifier, exception, options.dup) end true end
# File lib/exception_notifier.rb, line 40 def register_exception_notifier(name, notifier_or_options) if notifier_or_options.respond_to?(:call) @@notifiers[name] = notifier_or_options elsif notifier_or_options.is_a?(Hash) create_and_register_notifier(name, notifier_or_options) else raise ArgumentError, "Invalid notifier '#{name}' defined as #{notifier_or_options.inspect}" end end
Generated with the Darkfish Rdoc Generator 2.