Class: ExceptionNotifier::IrcNotifier
- Inherits:
-
BaseNotifier
- Object
- BaseNotifier
- ExceptionNotifier::IrcNotifier
- Defined in:
- lib/exception_notifier/irc_notifier.rb
Instance Attribute Summary
Attributes inherited from BaseNotifier
Instance Method Summary collapse
- #call(exception, options = {}) ⇒ Object
-
#initialize(options) ⇒ IrcNotifier
constructor
A new instance of IrcNotifier.
- #send_message(message) ⇒ Object
Methods inherited from BaseNotifier
#_post_callback, #_pre_callback, #send_notice
Constructor Details
#initialize(options) ⇒ IrcNotifier
Returns a new instance of IrcNotifier.
5 6 7 8 9 |
# File 'lib/exception_notifier/irc_notifier.rb', line 5 def initialize() super @config = OpenStruct.new () end |
Instance Method Details
#call(exception, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/exception_notifier/irc_notifier.rb', line 11 def call(exception, = {}) errors_count = [:accumulated_errors_count].to_i occurrences = "(#{errors_count} times)" if errors_count > 1 = "#{occurrences}'#{exception.}'" += " on '#{exception.backtrace.first}'" if exception.backtrace return unless active? send_notice(exception, , ) do |msg, _| ([*@config.prefix, *msg].join(' ')) end end |
#send_message(message) ⇒ Object
25 26 27 |
# File 'lib/exception_notifier/irc_notifier.rb', line 25 def () CarrierPigeon.send @config.irc.merge(message: ) end |