Class: ExceptionNotifier::BaseNotifier
- Inherits:
-
Object
- Object
- ExceptionNotifier::BaseNotifier
- Defined in:
- lib/exception_notifier/base_notifier.rb
Direct Known Subclasses
DatadogNotifier, EmailNotifier, GoogleChatNotifier, HipchatNotifier, IrcNotifier, MattermostNotifier, SlackNotifier, SnsNotifier, TeamsNotifier, WebhookNotifier
Instance Attribute Summary collapse
-
#base_options ⇒ Object
Returns the value of attribute base_options.
Instance Method Summary collapse
- #_post_callback(exception, options, message, message_opts) ⇒ Object
- #_pre_callback(exception, options, message, message_opts) ⇒ Object
-
#initialize(options = {}) ⇒ BaseNotifier
constructor
A new instance of BaseNotifier.
- #send_notice(exception, options, message, message_opts = nil) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ BaseNotifier
Returns a new instance of BaseNotifier.
7 8 9 |
# File 'lib/exception_notifier/base_notifier.rb', line 7 def initialize( = {}) @base_options = end |
Instance Attribute Details
#base_options ⇒ Object
Returns the value of attribute base_options.
5 6 7 |
# File 'lib/exception_notifier/base_notifier.rb', line 5 def @base_options end |
Instance Method Details
#_post_callback(exception, options, message, message_opts) ⇒ Object
24 25 26 27 28 |
# File 'lib/exception_notifier/base_notifier.rb', line 24 def _post_callback(exception, , , ) return unless @base_options[:post_callback].respond_to?(:call) @base_options[:post_callback].call(, self, exception.backtrace, , ) end |
#_pre_callback(exception, options, message, message_opts) ⇒ Object
18 19 20 21 22 |
# File 'lib/exception_notifier/base_notifier.rb', line 18 def _pre_callback(exception, , , ) return unless @base_options[:pre_callback].respond_to?(:call) @base_options[:pre_callback].call(, self, exception.backtrace, , ) end |
#send_notice(exception, options, message, message_opts = nil) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/exception_notifier/base_notifier.rb', line 11 def send_notice(exception, , , = nil) _pre_callback(exception, , , ) result = yield(, ) _post_callback(exception, , , ) result end |