Class: ExceptionNotifier::CampfireNotifier
- Inherits:
-
BaseNotifier
- Object
- BaseNotifier
- ExceptionNotifier::CampfireNotifier
- Defined in:
- lib/exception_notifier/campfire_notifier.rb
Instance Attribute Summary collapse
-
#room ⇒ Object
Returns the value of attribute room.
-
#subdomain ⇒ Object
Returns the value of attribute subdomain.
-
#token ⇒ Object
Returns the value of attribute token.
Attributes inherited from BaseNotifier
Instance Method Summary collapse
- #call(exception, options = {}) ⇒ Object
-
#initialize(options) ⇒ CampfireNotifier
constructor
A new instance of CampfireNotifier.
Methods inherited from BaseNotifier
#_post_callback, #_pre_callback, #send_notice
Constructor Details
#initialize(options) ⇒ CampfireNotifier
Returns a new instance of CampfireNotifier.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/exception_notifier/campfire_notifier.rb', line 9 def initialize() super begin subdomain = .delete(:subdomain) room_name = .delete(:room_name) @campfire = Tinder::Campfire.new subdomain, @room = @campfire.find_room_by_name room_name rescue StandardError @campfire = @room = nil end end |
Instance Attribute Details
#room ⇒ Object
Returns the value of attribute room.
7 8 9 |
# File 'lib/exception_notifier/campfire_notifier.rb', line 7 def room @room end |
#subdomain ⇒ Object
Returns the value of attribute subdomain.
5 6 7 |
# File 'lib/exception_notifier/campfire_notifier.rb', line 5 def subdomain @subdomain end |
#token ⇒ Object
Returns the value of attribute token.
6 7 8 |
# File 'lib/exception_notifier/campfire_notifier.rb', line 6 def token @token end |
Instance Method Details
#call(exception, options = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/exception_notifier/campfire_notifier.rb', line 21 def call(exception, = {}) return unless active? = if [:accumulated_errors_count].to_i > 1 "The exception occurred #{[:accumulated_errors_count]} times: '#{exception.}'" else "A new exception occurred: '#{exception.}'" end += " on '#{exception.backtrace.first}'" if exception.backtrace send_notice(exception, , ) do |msg, _| @room.paste msg end end |