Class: ExceptionNotifier::BaseNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/exception_notifier/base_notifier.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ BaseNotifier

Returns a new instance of BaseNotifier.



5
6
7
# File 'lib/exception_notifier/base_notifier.rb', line 5

def initialize(options={})
  @base_options = options
end

Instance Attribute Details

#base_optionsObject

Returns the value of attribute base_options.



3
4
5
# File 'lib/exception_notifier/base_notifier.rb', line 3

def base_options
  @base_options
end

Instance Method Details

#_post_callback(exception, options, message, message_opts) ⇒ Object



20
21
22
# File 'lib/exception_notifier/base_notifier.rb', line 20

def _post_callback(exception, options, message, message_opts)
  @base_options[:post_callback].call(options, self, exception.backtrace, message, message_opts) if @base_options[:post_callback].respond_to?(:call)
end

#_pre_callback(exception, options, message, message_opts) ⇒ Object



16
17
18
# File 'lib/exception_notifier/base_notifier.rb', line 16

def _pre_callback(exception, options, message, message_opts)
  @base_options[:pre_callback].call(options, self, exception.backtrace, message, message_opts) if @base_options[:pre_callback].respond_to?(:call)
end

#send_notice(exception, options, message, message_opts = nil) ⇒ Object



9
10
11
12
13
14
# File 'lib/exception_notifier/base_notifier.rb', line 9

def send_notice(exception, options, message, message_opts=nil)
  _pre_callback(exception, options, message, message_opts)
  result = yield(message, message_opts)
  _post_callback(exception, options, message, message_opts)
  result
end