Sha256: 091520abd61e319e54a0f1d23d4a6b9161f527a589030b73194f9fe55d380537

Contents?: true

Size: 767 Bytes

Versions: 1

Compression:

Stored size: 767 Bytes

Contents

module ExceptionNotifier
  class CampfireNotifier

    attr_accessor :subdomain
    attr_accessor :token
    attr_accessor :room

    def initialize(options)
      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
        @room.paste message message
      end
    end

    private

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
exception_notification-4.1.2 lib/exception_notifier/campfire_notifier.rb