Class: Cms::ErrorHandling::NotifierService
- Inherits:
-
Object
- Object
- Cms::ErrorHandling::NotifierService
- Defined in:
- lib/cms/error_handling.rb
Instance Attribute Summary collapse
-
#notifiers ⇒ Object
readonly
Returns the value of attribute notifiers.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ NotifierService
constructor
A new instance of NotifierService.
- #notify(exception) ⇒ Object
- #register_notifier_call(callable_object = nil, &block) ⇒ Object
Constructor Details
#initialize ⇒ NotifierService
Returns a new instance of NotifierService.
56 57 58 59 60 |
# File 'lib/cms/error_handling.rb', line 56 def initialize @notifiers = [] autoload_notifiers end |
Instance Attribute Details
#notifiers ⇒ Object (readonly)
Returns the value of attribute notifiers.
54 55 56 |
# File 'lib/cms/error_handling.rb', line 54 def notifiers @notifiers end |
Class Method Details
.service ⇒ Object
50 51 52 |
# File 'lib/cms/error_handling.rb', line 50 def self.service @service ||= new end |
Instance Method Details
#notify(exception) ⇒ Object
62 63 64 |
# File 'lib/cms/error_handling.rb', line 62 def notify(exception) notifiers.each { |notifier| notifier.call exception } end |
#register_notifier_call(callable_object = nil, &block) ⇒ Object
66 67 68 69 |
# File 'lib/cms/error_handling.rb', line 66 def register_notifier_call(callable_object = nil, &block) raise ArgumentError unless callable_object.respond_to?(:call) || block_given? @notifiers << (callable_object || block) end |