Class: RightSupport::Notifier::Base
- Includes:
- Log::Mixin
- Defined in:
- lib/right_support/notifiers/base.rb
Overview
base class for notifiers.
Constant Summary
Constants included from Log::Mixin
Log::Mixin::Decorator, Log::Mixin::UNDELEGATED
Instance Attribute Summary collapse
-
#backtrace_decoder ⇒ Object
readonly
Returns the value of attribute backtrace_decoder.
Instance Method Summary collapse
-
#debug_mode? ⇒ TrueClass|FalseClass
True in debug mode.
-
#initialize(options) ⇒ Base
constructor
A new instance of Base.
-
#notifiable?(e) ⇒ TrueClass|FalseClass
True if the error is notifiable for the current notifier, false to ignore error.
-
#notify(notification) ⇒ TrueClass
performs a notification.
Methods included from Log::Mixin
default_logger, default_logger=, included
Constructor Details
#initialize(options) ⇒ Base
Returns a new instance of Base.
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/right_support/notifiers/base.rb', line 39 def initialize() = { backtrace_limit: 10, notifiable_callback: nil, logger: nil }.merge() @notifiable_callback = [:notifiable_callback] @logger = [:logger] @backtrace_decoder = ::RightSupport::Notifier::Utility::BacktraceDecoder.new( backtrace_limit: Integer([:backtrace_limit]), path_blacklist: Array([:path_blacklist])) @debug_mode = ::ENV['DEBUG_MODE'] == 'true' end |
Instance Attribute Details
#backtrace_decoder ⇒ Object (readonly)
Returns the value of attribute backtrace_decoder.
27 28 29 |
# File 'lib/right_support/notifiers/base.rb', line 27 def backtrace_decoder @backtrace_decoder end |
Instance Method Details
#debug_mode? ⇒ TrueClass|FalseClass
Returns true in debug mode.
54 55 56 |
# File 'lib/right_support/notifiers/base.rb', line 54 def debug_mode? @debug_mode end |
#notifiable?(e) ⇒ TrueClass|FalseClass
Returns true if the error is notifiable for the current notifier, false to ignore error.
60 61 62 |
# File 'lib/right_support/notifiers/base.rb', line 60 def notifiable?(e) @notifiable_callback.nil? || @notifiable_callback.call(e) end |
#notify(notification) ⇒ TrueClass
performs a notification.
69 70 71 |
# File 'lib/right_support/notifiers/base.rb', line 69 def notify(notification) fail 'Must be overridden' end |