mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
8a0a103495
We didn't end up using the mailroom metaphor directly, so let's stick with a more conventional naming strategy.
18 lines
437 B
Ruby
18 lines
437 B
Ruby
class ActionMailbox::InboundEmail::Incineratable::Incineration
|
|
def initialize(inbound_email)
|
|
@inbound_email = inbound_email
|
|
end
|
|
|
|
def run
|
|
@inbound_email.destroy if due? && processed?
|
|
end
|
|
|
|
private
|
|
def due?
|
|
@inbound_email.updated_at < ActionMailbox::InboundEmail::Incineratable::INCINERATABLE_AFTER.ago.end_of_day
|
|
end
|
|
|
|
def processed?
|
|
@inbound_email.delivered? || @inbound_email.failed?
|
|
end
|
|
end
|