Sha256: 36f22b66f20c7cb043513ab97d4308358a7fc6a9db50db3400e7e8ed5e994ed8

Contents?: true

Size: 857 Bytes

Versions: 7

Compression:

Stored size: 857 Bytes

Contents

module ExceptionNotifier
  class CampfireNotifier < BaseNotifier

    attr_accessor :subdomain
    attr_accessor :token
    attr_accessor :room

    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

    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

    def active?
      !@room.nil?
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
exception_notification-4.2.1 lib/exception_notifier/campfire_notifier.rb
exception_notification-4.2.0 lib/exception_notifier/campfire_notifier.rb
exception_notification-4.2.0.rc1 lib/exception_notifier/campfire_notifier.rb
exception_notification_more_info-1.0.1 lib/exception_notifier/campfire_notifier.rb
exception_notification_more_info-1.0.0 lib/exception_notifier/campfire_notifier.rb
exception_notification-4.1.4 lib/exception_notifier/campfire_notifier.rb
exception_notification-4.1.3 lib/exception_notifier/campfire_notifier.rb