Class: MailHandler::Receiving::Notification::Delay

Inherits:
DelayState
  • Object
show all
Defined in:
lib/mailhandler/receiving/notification/email/states.rb

Instance Attribute Summary

Attributes inherited from DelayState

#context, #notified

Instance Method Summary collapse

Methods inherited from DelayState

#initialize, #notification_fired

Constructor Details

This class inherits a constructor from MailHandler::Receiving::Notification::DelayState

Instance Method Details

#notify(search) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/mailhandler/receiving/notification/email/states.rb', line 65

def notify(search)

  if search.result

    context.set_state(Received.new(context))
    context.notify(search)

  elsif Time.now - search.started_at >= context.max_time_to_notify

    context.set_state(MaxDelay.new(context))
    context.notify(search)

  else

    send_notification_email(:delayed, search)

  end

end