class ExceptionNotifier::CampfireNotifier

Attributes

room[RW]
subdomain[RW]
token[RW]

Public Class Methods

new(options) click to toggle source
Calls superclass method ExceptionNotifier::BaseNotifier.new
# File lib/exception_notifier/campfire_notifier.rb, line 8
def initialize(options)
  super
  begin
    subdomain = options.delete(:subdomain)
    room_name = options.delete(:room_name)
    @campfire = Tinder::Campfire.new subdomain, options
    @room     = @campfire.find_room_by_name room_name
  rescue
    @campfire = @room = nil
  end
end

Public Instance Methods

call(exception, options={}) click to toggle source
# File lib/exception_notifier/campfire_notifier.rb, line 20
def call(exception, options={})
  if active?
    message = "A new exception occurred: '#{exception.message}'"
    message += " on '#{exception.backtrace.first}'" if exception.backtrace
    send_notice(exception, options, message) do |msg, _|
      @room.paste msg
    end
  end
end

Private Instance Methods

active?() click to toggle source
# File lib/exception_notifier/campfire_notifier.rb, line 32
def active?
  !@room.nil?
end