Class: MList::EmailServer::Default

Inherits:
Base
  • Object
show all
Defined in:
lib/mlist/email_server/default.rb

Instance Attribute Summary

Attributes inherited from Base

#settings

Instance Method Summary collapse

Methods inherited from Base

#generate_message_id, #receive, #receiver

Constructor Details

#initialize(incoming_server, outgoing_server, settings = {}) ⇒ Default

Returns a new instance of Default.



5
6
7
8
9
# File 'lib/mlist/email_server/default.rb', line 5

def initialize(incoming_server, outgoing_server, settings = {})
  super(settings)
  @incoming_server, @outgoing_server = incoming_server, outgoing_server
  @incoming_server.receiver(self)
end

Instance Method Details

#deliver(tmail) ⇒ Object

Delegates delivery of email to outgoing server.



13
14
15
# File 'lib/mlist/email_server/default.rb', line 13

def deliver(tmail)
  @outgoing_server.deliver(tmail)
end

#executeObject

Delegates fetching emails to incoming server.



18
19
20
# File 'lib/mlist/email_server/default.rb', line 18

def execute
  @incoming_server.execute
end

#receive_email(email) ⇒ Object

Delegates processing of email from incoming server to receivers on self.



25
26
27
# File 'lib/mlist/email_server/default.rb', line 25

def receive_email(email)
  @receivers.each { |r| r.receive_email(email) }
end