Class: Racknga::ExceptionMailNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/racknga/exception_mail_notifier.rb

Overview

Ruby 1.9 only. 1.8 isn’t supported.

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ExceptionMailNotifier

Returns a new instance of ExceptionMailNotifier.



30
31
32
33
# File 'lib/racknga/exception_mail_notifier.rb', line 30

def initialize(options)
  @options = Utils.normalize_options(options || {})
  reset_limitation
end

Instance Method Details

#notify(exception, environment) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/racknga/exception_mail_notifier.rb', line 35

def notify(exception, environment)
  return if to.empty?

  if limitation_expired?
    send_summaries unless @summaries.empty?
    reset_limitation
  end

  if @mail_count < max_mail_count_in_limit_duration
    send_notification(exception, environment)
  else
    @summaries << summarize(exception, environment)
  end

  @mail_count += 1
end